@localheroai/cli 0.0.69 → 0.0.71-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/cli.js +8 -8
  2. package/dist/commands/ci.js +1 -1
  3. package/dist/commands/login.js +1 -1
  4. package/dist/commands/push.js +1 -1
  5. package/dist/utils/github.js +13 -6
  6. package/dist/utils/github.js.map +1 -1
  7. package/dist/utils/translation-utils.js +11 -11
  8. package/dist/utils/translation-utils.js.map +1 -1
  9. package/package.json +1 -1
  10. package/dist/api/auth.d.ts +0 -2
  11. package/dist/api/client.d.ts +0 -3
  12. package/dist/api/imports.d.ts +0 -5
  13. package/dist/api/projects.d.ts +0 -2
  14. package/dist/api/translation-jobs.js +0 -28
  15. package/dist/api/translation-jobs.js.map +0 -1
  16. package/dist/api/translations.d.ts +0 -15
  17. package/dist/cli.d.ts +0 -2
  18. package/dist/commands/_sync.js +0 -22
  19. package/dist/commands/_sync.js.map +0 -1
  20. package/dist/commands/_translate.js +0 -3
  21. package/dist/commands/_translate.js.map +0 -1
  22. package/dist/commands/github-action.js +0 -111
  23. package/dist/commands/github-action.js.map +0 -1
  24. package/dist/commands/init.d.ts +0 -1
  25. package/dist/commands/login.d.ts +0 -16
  26. package/dist/commands/sync.d.ts +0 -20
  27. package/dist/commands/sync.js +0 -22
  28. package/dist/commands/sync.js.map +0 -1
  29. package/dist/commands/translate.d.ts +0 -14
  30. package/dist/index.d.ts +0 -5
  31. package/dist/types/index.d.ts +0 -75
  32. package/dist/types/translate/index.js +0 -2
  33. package/dist/types/translate/index.js.map +0 -1
  34. package/dist/utils/auth.d.ts +0 -2
  35. package/dist/utils/chunked-json-processor.js +0 -52
  36. package/dist/utils/chunked-json-processor.js.map +0 -1
  37. package/dist/utils/common.js +0 -9
  38. package/dist/utils/common.js.map +0 -1
  39. package/dist/utils/config.d.ts +0 -23
  40. package/dist/utils/errors.js +0 -37
  41. package/dist/utils/errors.js.map +0 -1
  42. package/dist/utils/files.d.ts +0 -32
  43. package/dist/utils/git-diff.js +0 -251
  44. package/dist/utils/git-diff.js.map +0 -1
  45. package/dist/utils/git.d.ts +0 -21
  46. package/dist/utils/github.d.ts +0 -241
  47. package/dist/utils/import-service.d.ts +0 -4
  48. package/dist/utils/po-utils-fallback.js +0 -254
  49. package/dist/utils/po-utils-fallback.js.map +0 -1
  50. package/dist/utils/prompt-service.d.ts +0 -44
  51. package/dist/utils/streaming-json-processor.js +0 -125
  52. package/dist/utils/streaming-json-processor.js.map +0 -1
  53. package/dist/utils/sync-service.d.ts +0 -58
  54. package/dist/utils/translation-updater/common.d.ts +0 -6
  55. package/dist/utils/translation-updater/index.d.ts +0 -5
  56. package/dist/utils/translation-updater/json-handler.d.ts +0 -5
  57. package/dist/utils/translation-updater/yaml-handler.d.ts +0 -5
  58. package/dist/utils/translation-utils.d.ts +0 -30
  59. package/dist/utils/updater.js +0 -38
  60. package/dist/utils/updater.js.map +0 -1
@@ -1,241 +0,0 @@
1
- export function createGitHubActionFile(basePath: any, translationPaths: any): Promise<string>;
2
- export function workflowExists(basePath: any): boolean;
3
- export function autoCommitChanges(filesPath: any): void;
4
- export namespace githubService {
5
- namespace deps {
6
- export function exec(cmd: any, options: any): string;
7
- export let fs: {
8
- existsSync: typeof existsSync;
9
- access(path: import("fs").PathLike, mode?: number): Promise<void>;
10
- copyFile(src: import("fs").PathLike, dest: import("fs").PathLike, mode?: number): Promise<void>;
11
- open(path: import("fs").PathLike, flags?: string | number, mode?: import("fs").Mode): Promise<fs.FileHandle>;
12
- rename(oldPath: import("fs").PathLike, newPath: import("fs").PathLike): Promise<void>;
13
- truncate(path: import("fs").PathLike, len?: number): Promise<void>;
14
- rmdir(path: import("fs").PathLike, options?: import("fs").RmDirOptions): Promise<void>;
15
- rm(path: import("fs").PathLike, options?: import("fs").RmOptions): Promise<void>;
16
- mkdir(path: import("fs").PathLike, options: import("fs").MakeDirectoryOptions & {
17
- recursive: true;
18
- }): Promise<string | undefined>;
19
- mkdir(path: import("fs").PathLike, options?: import("fs").Mode | (import("fs").MakeDirectoryOptions & {
20
- recursive?: false | undefined;
21
- }) | null): Promise<void>;
22
- mkdir(path: import("fs").PathLike, options?: import("fs").Mode | import("fs").MakeDirectoryOptions | null): Promise<string | undefined>;
23
- readdir(path: import("fs").PathLike, options?: (import("fs").ObjectEncodingOptions & {
24
- withFileTypes?: false | undefined;
25
- recursive?: boolean | undefined;
26
- }) | BufferEncoding | null): Promise<string[]>;
27
- readdir(path: import("fs").PathLike, options: {
28
- encoding: "buffer";
29
- withFileTypes?: false | undefined;
30
- recursive?: boolean | undefined;
31
- } | "buffer"): Promise<Buffer[]>;
32
- readdir(path: import("fs").PathLike, options?: (import("fs").ObjectEncodingOptions & {
33
- withFileTypes?: false | undefined;
34
- recursive?: boolean | undefined;
35
- }) | BufferEncoding | null): Promise<string[] | Buffer[]>;
36
- readdir(path: import("fs").PathLike, options: import("fs").ObjectEncodingOptions & {
37
- withFileTypes: true;
38
- recursive?: boolean | undefined;
39
- }): Promise<import("fs").Dirent[]>;
40
- readlink(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
41
- readlink(path: import("fs").PathLike, options: import("fs").BufferEncodingOption): Promise<Buffer>;
42
- readlink(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | string | null): Promise<string | Buffer>;
43
- symlink(target: import("fs").PathLike, path: import("fs").PathLike, type?: string | null): Promise<void>;
44
- lstat(path: import("fs").PathLike, opts?: import("fs").StatOptions & {
45
- bigint?: false | undefined;
46
- }): Promise<import("fs").Stats>;
47
- lstat(path: import("fs").PathLike, opts: import("fs").StatOptions & {
48
- bigint: true;
49
- }): Promise<import("fs").BigIntStats>;
50
- lstat(path: import("fs").PathLike, opts?: import("fs").StatOptions): Promise<import("fs").Stats | import("fs").BigIntStats>;
51
- stat(path: import("fs").PathLike, opts?: import("fs").StatOptions & {
52
- bigint?: false | undefined;
53
- }): Promise<import("fs").Stats>;
54
- stat(path: import("fs").PathLike, opts: import("fs").StatOptions & {
55
- bigint: true;
56
- }): Promise<import("fs").BigIntStats>;
57
- stat(path: import("fs").PathLike, opts?: import("fs").StatOptions): Promise<import("fs").Stats | import("fs").BigIntStats>;
58
- statfs(path: import("fs").PathLike, opts?: import("fs").StatFsOptions & {
59
- bigint?: false | undefined;
60
- }): Promise<import("fs").StatsFs>;
61
- statfs(path: import("fs").PathLike, opts: import("fs").StatFsOptions & {
62
- bigint: true;
63
- }): Promise<import("fs").BigIntStatsFs>;
64
- statfs(path: import("fs").PathLike, opts?: import("fs").StatFsOptions): Promise<import("fs").StatsFs | import("fs").BigIntStatsFs>;
65
- link(existingPath: import("fs").PathLike, newPath: import("fs").PathLike): Promise<void>;
66
- unlink(path: import("fs").PathLike): Promise<void>;
67
- chmod(path: import("fs").PathLike, mode: import("fs").Mode): Promise<void>;
68
- lchmod(path: import("fs").PathLike, mode: import("fs").Mode): Promise<void>;
69
- lchown(path: import("fs").PathLike, uid: number, gid: number): Promise<void>;
70
- lutimes(path: import("fs").PathLike, atime: import("fs").TimeLike, mtime: import("fs").TimeLike): Promise<void>;
71
- chown(path: import("fs").PathLike, uid: number, gid: number): Promise<void>;
72
- utimes(path: import("fs").PathLike, atime: import("fs").TimeLike, mtime: import("fs").TimeLike): Promise<void>;
73
- realpath(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
74
- realpath(path: import("fs").PathLike, options: import("fs").BufferEncodingOption): Promise<Buffer>;
75
- realpath(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
76
- mkdtemp(prefix: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
77
- mkdtemp(prefix: string, options: import("fs").BufferEncodingOption): Promise<Buffer>;
78
- mkdtemp(prefix: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
79
- writeFile(file: import("fs").PathLike | fs.FileHandle, data: string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | import("stream"), options?: (import("fs").ObjectEncodingOptions & {
80
- mode?: import("fs").Mode | undefined;
81
- flag?: import("fs").OpenMode | undefined;
82
- flush?: boolean | undefined;
83
- } & import("events").Abortable) | BufferEncoding | null): Promise<void>;
84
- appendFile(path: import("fs").PathLike | fs.FileHandle, data: string | Uint8Array, options?: (import("fs").ObjectEncodingOptions & fs.FlagAndOpenMode & {
85
- flush?: boolean | undefined;
86
- }) | BufferEncoding | null): Promise<void>;
87
- readFile(path: import("fs").PathLike | fs.FileHandle, options?: ({
88
- encoding?: null | undefined;
89
- flag?: import("fs").OpenMode | undefined;
90
- } & import("events").Abortable) | null): Promise<Buffer>;
91
- readFile(path: import("fs").PathLike | fs.FileHandle, options: ({
92
- encoding: BufferEncoding;
93
- flag?: import("fs").OpenMode | undefined;
94
- } & import("events").Abortable) | BufferEncoding): Promise<string>;
95
- readFile(path: import("fs").PathLike | fs.FileHandle, options?: (import("fs").ObjectEncodingOptions & import("events").Abortable & {
96
- flag?: import("fs").OpenMode | undefined;
97
- }) | BufferEncoding | null): Promise<string | Buffer>;
98
- opendir(path: import("fs").PathLike, options?: import("fs").OpenDirOptions): Promise<import("fs").Dir>;
99
- watch(filename: import("fs").PathLike, options: (import("fs").WatchOptions & {
100
- encoding: "buffer";
101
- }) | "buffer"): AsyncIterable<fs.FileChangeInfo<Buffer>>;
102
- watch(filename: import("fs").PathLike, options?: import("fs").WatchOptions | BufferEncoding): AsyncIterable<fs.FileChangeInfo<string>>;
103
- watch(filename: import("fs").PathLike, options: import("fs").WatchOptions | string): AsyncIterable<fs.FileChangeInfo<string>> | AsyncIterable<fs.FileChangeInfo<Buffer>>;
104
- cp(source: string | URL, destination: string | URL, opts?: import("fs").CopyOptions): Promise<void>;
105
- glob(pattern: string | string[]): NodeJS.AsyncIterator<string>;
106
- glob(pattern: string | string[], opt: import("fs").GlobOptionsWithFileTypes): NodeJS.AsyncIterator<import("fs").Dirent>;
107
- glob(pattern: string | string[], opt: import("fs").GlobOptionsWithoutFileTypes): NodeJS.AsyncIterator<string>;
108
- glob(pattern: string | string[], opt: import("fs").GlobOptions): NodeJS.AsyncIterator<import("fs").Dirent | string>;
109
- constants: typeof import("fs").constants;
110
- };
111
- export { path };
112
- export let env: NodeJS.ProcessEnv;
113
- }
114
- function setDependencies(customDeps?: {}): {
115
- deps: {
116
- exec: (cmd: any, options: any) => string;
117
- fs: {
118
- existsSync: typeof existsSync;
119
- access(path: import("fs").PathLike, mode?: number): Promise<void>;
120
- copyFile(src: import("fs").PathLike, dest: import("fs").PathLike, mode?: number): Promise<void>;
121
- open(path: import("fs").PathLike, flags?: string | number, mode?: import("fs").Mode): Promise<fs.FileHandle>;
122
- rename(oldPath: import("fs").PathLike, newPath: import("fs").PathLike): Promise<void>;
123
- truncate(path: import("fs").PathLike, len?: number): Promise<void>;
124
- rmdir(path: import("fs").PathLike, options?: import("fs").RmDirOptions): Promise<void>;
125
- rm(path: import("fs").PathLike, options?: import("fs").RmOptions): Promise<void>;
126
- mkdir(path: import("fs").PathLike, options: import("fs").MakeDirectoryOptions & {
127
- recursive: true;
128
- }): Promise<string | undefined>;
129
- mkdir(path: import("fs").PathLike, options?: import("fs").Mode | (import("fs").MakeDirectoryOptions & {
130
- recursive?: false | undefined;
131
- }) | null): Promise<void>;
132
- mkdir(path: import("fs").PathLike, options?: import("fs").Mode | import("fs").MakeDirectoryOptions | null): Promise<string | undefined>;
133
- readdir(path: import("fs").PathLike, options?: (import("fs").ObjectEncodingOptions & {
134
- withFileTypes?: false | undefined;
135
- recursive?: boolean | undefined;
136
- }) | BufferEncoding | null): Promise<string[]>;
137
- readdir(path: import("fs").PathLike, options: {
138
- encoding: "buffer";
139
- withFileTypes?: false | undefined;
140
- recursive?: boolean | undefined;
141
- } | "buffer"): Promise<Buffer[]>;
142
- readdir(path: import("fs").PathLike, options?: (import("fs").ObjectEncodingOptions & {
143
- withFileTypes?: false | undefined;
144
- recursive?: boolean | undefined;
145
- }) | BufferEncoding | null): Promise<string[] | Buffer[]>;
146
- readdir(path: import("fs").PathLike, options: import("fs").ObjectEncodingOptions & {
147
- withFileTypes: true;
148
- recursive?: boolean | undefined;
149
- }): Promise<import("fs").Dirent[]>;
150
- readlink(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
151
- readlink(path: import("fs").PathLike, options: import("fs").BufferEncodingOption): Promise<Buffer>;
152
- readlink(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | string | null): Promise<string | Buffer>;
153
- symlink(target: import("fs").PathLike, path: import("fs").PathLike, type?: string | null): Promise<void>;
154
- lstat(path: import("fs").PathLike, opts?: import("fs").StatOptions & {
155
- bigint?: false | undefined;
156
- }): Promise<import("fs").Stats>;
157
- lstat(path: import("fs").PathLike, opts: import("fs").StatOptions & {
158
- bigint: true;
159
- }): Promise<import("fs").BigIntStats>;
160
- lstat(path: import("fs").PathLike, opts?: import("fs").StatOptions): Promise<import("fs").Stats | import("fs").BigIntStats>;
161
- stat(path: import("fs").PathLike, opts?: import("fs").StatOptions & {
162
- bigint?: false | undefined;
163
- }): Promise<import("fs").Stats>;
164
- stat(path: import("fs").PathLike, opts: import("fs").StatOptions & {
165
- bigint: true;
166
- }): Promise<import("fs").BigIntStats>;
167
- stat(path: import("fs").PathLike, opts?: import("fs").StatOptions): Promise<import("fs").Stats | import("fs").BigIntStats>;
168
- statfs(path: import("fs").PathLike, opts?: import("fs").StatFsOptions & {
169
- bigint?: false | undefined;
170
- }): Promise<import("fs").StatsFs>;
171
- statfs(path: import("fs").PathLike, opts: import("fs").StatFsOptions & {
172
- bigint: true;
173
- }): Promise<import("fs").BigIntStatsFs>;
174
- statfs(path: import("fs").PathLike, opts?: import("fs").StatFsOptions): Promise<import("fs").StatsFs | import("fs").BigIntStatsFs>;
175
- link(existingPath: import("fs").PathLike, newPath: import("fs").PathLike): Promise<void>;
176
- unlink(path: import("fs").PathLike): Promise<void>;
177
- chmod(path: import("fs").PathLike, mode: import("fs").Mode): Promise<void>;
178
- lchmod(path: import("fs").PathLike, mode: import("fs").Mode): Promise<void>;
179
- lchown(path: import("fs").PathLike, uid: number, gid: number): Promise<void>;
180
- lutimes(path: import("fs").PathLike, atime: import("fs").TimeLike, mtime: import("fs").TimeLike): Promise<void>;
181
- chown(path: import("fs").PathLike, uid: number, gid: number): Promise<void>;
182
- utimes(path: import("fs").PathLike, atime: import("fs").TimeLike, mtime: import("fs").TimeLike): Promise<void>;
183
- realpath(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
184
- realpath(path: import("fs").PathLike, options: import("fs").BufferEncodingOption): Promise<Buffer>;
185
- realpath(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
186
- mkdtemp(prefix: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
187
- mkdtemp(prefix: string, options: import("fs").BufferEncodingOption): Promise<Buffer>;
188
- mkdtemp(prefix: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
189
- writeFile(file: import("fs").PathLike | fs.FileHandle, data: string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | import("stream"), options?: (import("fs").ObjectEncodingOptions & {
190
- mode?: import("fs").Mode | undefined;
191
- flag?: import("fs").OpenMode | undefined;
192
- flush?: boolean | undefined;
193
- } & import("events").Abortable) | BufferEncoding | null): Promise<void>;
194
- appendFile(path: import("fs").PathLike | fs.FileHandle, data: string | Uint8Array, options?: (import("fs").ObjectEncodingOptions & fs.FlagAndOpenMode & {
195
- flush?: boolean | undefined;
196
- }) | BufferEncoding | null): Promise<void>;
197
- readFile(path: import("fs").PathLike | fs.FileHandle, options?: ({
198
- encoding?: null | undefined;
199
- flag?: import("fs").OpenMode | undefined;
200
- } & import("events").Abortable) | null): Promise<Buffer>;
201
- readFile(path: import("fs").PathLike | fs.FileHandle, options: ({
202
- encoding: BufferEncoding;
203
- flag?: import("fs").OpenMode | undefined;
204
- } & import("events").Abortable) | BufferEncoding): Promise<string>;
205
- readFile(path: import("fs").PathLike | fs.FileHandle, options?: (import("fs").ObjectEncodingOptions & import("events").Abortable & {
206
- flag?: import("fs").OpenMode | undefined;
207
- }) | BufferEncoding | null): Promise<string | Buffer>;
208
- opendir(path: import("fs").PathLike, options?: import("fs").OpenDirOptions): Promise<import("fs").Dir>;
209
- watch(filename: import("fs").PathLike, options: (import("fs").WatchOptions & {
210
- encoding: "buffer";
211
- }) | "buffer"): AsyncIterable<fs.FileChangeInfo<Buffer>>;
212
- watch(filename: import("fs").PathLike, options?: import("fs").WatchOptions | BufferEncoding): AsyncIterable<fs.FileChangeInfo<string>>;
213
- watch(filename: import("fs").PathLike, options: import("fs").WatchOptions | string): AsyncIterable<fs.FileChangeInfo<string>> | AsyncIterable<fs.FileChangeInfo<Buffer>>;
214
- cp(source: string | URL, destination: string | URL, opts?: import("fs").CopyOptions): Promise<void>;
215
- glob(pattern: string | string[]): NodeJS.AsyncIterator<string>;
216
- glob(pattern: string | string[], opt: import("fs").GlobOptionsWithFileTypes): NodeJS.AsyncIterator<import("fs").Dirent>;
217
- glob(pattern: string | string[], opt: import("fs").GlobOptionsWithoutFileTypes): NodeJS.AsyncIterator<string>;
218
- glob(pattern: string | string[], opt: import("fs").GlobOptions): NodeJS.AsyncIterator<import("fs").Dirent | string>;
219
- constants: typeof import("fs").constants;
220
- };
221
- path: path.PlatformPath;
222
- env: NodeJS.ProcessEnv;
223
- };
224
- setDependencies(customDeps?: {}): /*elided*/ any;
225
- isGitHubAction(): boolean;
226
- workflowExists(basePath: any): boolean;
227
- getWorkflowDir(basePath: any): string;
228
- getGithubActionWorkflowFilePath(basePath: any): string;
229
- createGitHubActionFile(basePath: any, translationPaths: any): Promise<string>;
230
- autoCommitChanges(filesPath: any): void;
231
- };
232
- function isGitHubAction(): boolean;
233
- function workflowExists(basePath: any): boolean;
234
- function getWorkflowDir(basePath: any): string;
235
- function getGithubActionWorkflowFilePath(basePath: any): string;
236
- function createGitHubActionFile(basePath: any, translationPaths: any): Promise<string>;
237
- function autoCommitChanges(filesPath: any): void;
238
- }
239
- import { existsSync } from 'fs';
240
- import { promises as fs_1 } from 'fs';
241
- import path from 'path';
@@ -1,4 +0,0 @@
1
- export namespace importService {
2
- function findTranslationFiles(config: any, basePath?: string): Promise<any>;
3
- function importTranslations(config: any, basePath?: string): Promise<any>;
4
- }
@@ -1,254 +0,0 @@
1
- import { po } from 'gettext-parser';
2
- import { createUniqueKey, parseUniqueKey, parsePoFile, normalizeStringValue, PLURAL_SUFFIX } from './po-utils.js';
3
- /**
4
- * Build a map of msgid_plural values to check for duplicates
5
- */
6
- function buildPluralFormsMap(parsed) {
7
- const pluralForms = new Map();
8
- Object.entries(parsed.translations).forEach(([context, entries]) => {
9
- if (typeof entries === 'object' && entries !== null) {
10
- Object.entries(entries).forEach(([msgid, entry]) => {
11
- if (msgid === '' || !entry.msgid_plural)
12
- return;
13
- // Map the plural form to its context and original msgid
14
- const pluralKey = createUniqueKey(entry.msgid_plural, context !== '' ? context : undefined);
15
- pluralForms.set(pluralKey, { context, msgid });
16
- });
17
- }
18
- });
19
- return pluralForms;
20
- }
21
- /**
22
- * Check if a key is a plural suffix key
23
- */
24
- function isPluralKey(key) {
25
- return key.endsWith(PLURAL_SUFFIX);
26
- }
27
- /**
28
- * Get the base key from a plural suffix key
29
- */
30
- function getBaseKeyFromPlural(key) {
31
- return key.replace(/__plural_\d+$/, '');
32
- }
33
- /**
34
- * Group plural translations together
35
- */
36
- function groupPluralTranslations(translations) {
37
- const regular = {};
38
- const pluralGroups = new Map();
39
- // First pass: identify plural pairs
40
- Object.keys(translations).forEach(key => {
41
- if (isPluralKey(key)) {
42
- const baseKey = getBaseKeyFromPlural(key);
43
- if (translations[baseKey]) {
44
- // This is a plural pair
45
- pluralGroups.set(baseKey, {
46
- singular: translations[baseKey],
47
- plural: translations[key]
48
- });
49
- }
50
- }
51
- });
52
- // Second pass: add regular keys (excluding those in plural pairs)
53
- Object.entries(translations).forEach(([key, value]) => {
54
- if (!isPluralKey(key) && !pluralGroups.has(key)) {
55
- regular[key] = value;
56
- }
57
- });
58
- return { regular, pluralGroups };
59
- }
60
- /**
61
- * Detect the fold length used in the original .po file by analyzing line lengths
62
- * Returns the detected fold length, or 76 (gettext default) if no clear pattern
63
- */
64
- function detectFoldLength(content) {
65
- const lines = content.split('\n');
66
- const quotedLines = lines.filter(line => line.trim().startsWith('"') && line.trim().endsWith('"'));
67
- if (quotedLines.length < 5) {
68
- return 76; // Use gettext default
69
- }
70
- // Check if the file has multiline strings (indicates intentional wrapping)
71
- const hasMultilineStrings = lines.some(line => line.trim() === 'msgid ""' || line.trim() === 'msgstr ""');
72
- if (!hasMultilineStrings) {
73
- return 76; // Use default for simple files
74
- }
75
- // Find the longest line length - this represents the wrap point used
76
- const maxLength = Math.max(...quotedLines.map(line => line.length));
77
- // If the longest line is in a reasonable range, use it
78
- // Otherwise fall back to gettext standard
79
- if (maxLength >= 70 && maxLength <= 100) {
80
- return maxLength;
81
- }
82
- return 76; // gettext default
83
- }
84
- /**
85
- * Old implementation of updatePoFile for fallback when new entries need to be added
86
- */
87
- export function updatePoFileOld(originalContent, translations, options) {
88
- const parsed = po.parse(originalContent);
89
- const updatedTranslations = new Set();
90
- const pluralFormsMap = buildPluralFormsMap(parsed);
91
- let hasChanges = false;
92
- const { regular, pluralGroups } = groupPluralTranslations(translations);
93
- Object.entries(parsed.translations).forEach(([context, entries]) => {
94
- if (typeof entries === 'object' && entries !== null) {
95
- Object.entries(entries).forEach(([msgid, entry]) => {
96
- if (msgid === '')
97
- return; // Skip header
98
- const uniqueKey = createUniqueKey(msgid, context !== '' ? context : undefined);
99
- // Check if this is a plural entry (either complete pair or partial)
100
- if (entry.msgid_plural) {
101
- const isCompletePair = pluralGroups.has(uniqueKey);
102
- const hasSingularOnly = regular[uniqueKey];
103
- if (isCompletePair) {
104
- const pluralData = pluralGroups.get(uniqueKey);
105
- const singularValue = pluralData.singular;
106
- const currentValue = entry.msgstr[0] || '';
107
- // Skip updating only if this is a source language entry and values match AND current value is not empty
108
- const skipSingular = (singularValue === msgid && options?.sourceLanguage === options?.targetLanguage && currentValue.trim() !== '');
109
- if (!skipSingular && currentValue.trim() !== singularValue.trim()) {
110
- entry.msgstr[0] = singularValue;
111
- hasChanges = true;
112
- }
113
- const pluralValue = pluralData.plural;
114
- const currentPluralValue = entry.msgstr[1] || '';
115
- // Skip updating only if this is a source language entry and values match AND current value is not empty
116
- const skipPlural = (pluralValue === entry.msgid_plural && options?.sourceLanguage === options?.targetLanguage && currentPluralValue.trim() !== '');
117
- if (!skipPlural && currentPluralValue.trim() !== pluralValue.trim()) {
118
- entry.msgstr[1] = pluralValue;
119
- hasChanges = true;
120
- }
121
- updatedTranslations.add(uniqueKey);
122
- updatedTranslations.add(uniqueKey + PLURAL_SUFFIX);
123
- }
124
- else if (hasSingularOnly) {
125
- // Handle partial plural translation (singular only)
126
- const singularValue = regular[uniqueKey];
127
- const currentValue = entry.msgstr[0] || '';
128
- // Skip updating only if this is a source language entry and values match AND current value is not empty
129
- const skipSingular = (singularValue === msgid && options?.sourceLanguage === options?.targetLanguage && currentValue.trim() !== '');
130
- if (!skipSingular && currentValue.trim() !== singularValue.trim()) {
131
- entry.msgstr[0] = singularValue;
132
- hasChanges = true;
133
- }
134
- updatedTranslations.add(uniqueKey);
135
- }
136
- }
137
- else if (regular[uniqueKey]) {
138
- const newValue = regular[uniqueKey];
139
- // Skip updating if this is a source language entry (msgid === msgstr)
140
- if (newValue === msgid && options?.sourceLanguage === options?.targetLanguage) {
141
- updatedTranslations.add(uniqueKey);
142
- return;
143
- }
144
- const currentValue = normalizeStringValue(entry.msgstr);
145
- const normalizedNewValue = normalizeStringValue(newValue);
146
- // Only update if the normalized content is actually different
147
- // This prevents unnecessary line wrapping changes
148
- if (currentValue !== normalizedNewValue) {
149
- entry.msgstr = [newValue];
150
- hasChanges = true;
151
- }
152
- updatedTranslations.add(uniqueKey);
153
- }
154
- });
155
- }
156
- });
157
- // Add new translations that weren't found in existing entries
158
- // But skip plural suffix keys - they should not be added as separate entries
159
- Object.entries(regular).forEach(([uniqueKey, value]) => {
160
- if (!updatedTranslations.has(uniqueKey)) {
161
- const { msgid, context } = parseUniqueKey(uniqueKey);
162
- const contextKey = context || '';
163
- // this can happen with malformed keys
164
- if (!msgid || msgid.trim() === '') {
165
- return;
166
- }
167
- // Skip adding new entries where msgid === msgstr (source language files only)
168
- if (value === msgid && options?.sourceLanguage === options?.targetLanguage) {
169
- return;
170
- }
171
- // Skip if this msgid is already used as msgid_plural in an existing entry
172
- if (pluralFormsMap.has(uniqueKey)) {
173
- return;
174
- }
175
- // Initialize context if it doesn't exist
176
- if (!parsed.translations[contextKey]) {
177
- parsed.translations[contextKey] = {};
178
- }
179
- parsed.translations[contextKey][msgid] = {
180
- msgid: msgid,
181
- msgstr: [value]
182
- };
183
- hasChanges = true;
184
- }
185
- });
186
- // Add new plural translations that weren't found in existing entries
187
- pluralGroups.forEach((pluralData, uniqueKey) => {
188
- if (!updatedTranslations.has(uniqueKey)) {
189
- const { msgid, context } = parseUniqueKey(uniqueKey);
190
- const contextKey = context || '';
191
- // this can happen with malformed keys
192
- if (!msgid || msgid.trim() === '') {
193
- return;
194
- }
195
- const pluralKey = uniqueKey + PLURAL_SUFFIX;
196
- // Try to find the proper msgid_plural from the source file if available
197
- let msgid_plural = pluralData.plural; // fallback
198
- if (options?.sourceContent) {
199
- try {
200
- const sourceParsed = parsePoFile(options.sourceContent);
201
- const sourceEntries = sourceParsed.entries;
202
- // Find the matching source entry with msgid_plural
203
- const sourceEntry = sourceEntries.find(entry => {
204
- const sourceKey = createUniqueKey(entry.msgid, entry.msgctxt);
205
- return sourceKey === uniqueKey && entry.msgid_plural;
206
- });
207
- if (sourceEntry && sourceEntry.msgid_plural) {
208
- msgid_plural = sourceEntry.msgid_plural;
209
- }
210
- }
211
- catch (error) {
212
- // If source parsing fails, continue with fallback
213
- console.warn('Failed to parse source content for msgid_plural lookup', error);
214
- }
215
- }
216
- // Initialize context if it doesn't exist
217
- if (!parsed.translations[contextKey]) {
218
- parsed.translations[contextKey] = {};
219
- }
220
- // Create new plural entry with proper msgid_plural
221
- parsed.translations[contextKey][msgid] = {
222
- msgid: msgid,
223
- msgid_plural: msgid_plural,
224
- msgstr: [pluralData.singular, pluralData.plural]
225
- };
226
- hasChanges = true;
227
- // Mark both keys as updated
228
- updatedTranslations.add(uniqueKey);
229
- updatedTranslations.add(pluralKey);
230
- }
231
- });
232
- // If no actual changes were made, return original content to preserve formatting
233
- if (!hasChanges) {
234
- return originalContent;
235
- }
236
- // Extract header section from original content
237
- const lines = originalContent.split('\n');
238
- const headerEndIndex = lines.findIndex((line, index) => index > 0 && line.trim() === '' && lines[index - 1].includes('"'));
239
- let headerSection = '';
240
- if (headerEndIndex > 0) {
241
- headerSection = lines.slice(0, headerEndIndex + 1).join('\n') + '\n';
242
- }
243
- // Use detected fold length from original content
244
- const foldLength = detectFoldLength(originalContent);
245
- const compiled = po.compile(parsed, { foldLength }).toString();
246
- const compiledLines = compiled.split('\n');
247
- const compiledHeaderEndIndex = compiledLines.findIndex((line, index) => index > 0 && line.trim() === '' && compiledLines[index - 1].includes('"'));
248
- if (headerSection && compiledHeaderEndIndex > 0) {
249
- const bodySection = compiledLines.slice(compiledHeaderEndIndex + 1).join('\n');
250
- return headerSection + bodySection;
251
- }
252
- return compiled;
253
- }
254
- //# sourceMappingURL=po-utils-fallback.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"po-utils-fallback.js","sourceRoot":"","sources":["../../src/utils/po-utils-fallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,cAAc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AAE,KAAK,EAAE,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAClE,CAAC;IAEF,IAAI,aAAa,GAAG,EAAE,CAAC;IACvB,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;QACvB,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvE,CAAC;IAED,iDAAiD;IACjD,MAAM,UAAU,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC/D,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,sBAAsB,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACrE,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,aAAa,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAC1E,CAAC;IAEF,IAAI,aAAa,IAAI,sBAAsB,GAAG,CAAC,EAAE,CAAC;QAChD,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,sBAAsB,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/E,OAAO,aAAa,GAAG,WAAW,CAAC;IACrC,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,44 +0,0 @@
1
- interface ProjectService {
2
- listProjects: () => Promise<Array<{
3
- id: string;
4
- name: string;
5
- }>>;
6
- }
7
- interface ProjectSetup {
8
- projectName: string;
9
- sourceLocale: string;
10
- outputLocales: string[];
11
- translationPath: string;
12
- ignorePaths: string[];
13
- }
14
- interface ProjectSelection {
15
- choice: string;
16
- project?: {
17
- id: string;
18
- name: string;
19
- };
20
- }
21
- export declare function createPromptService(deps?: {
22
- inquirer?: any;
23
- }): {
24
- getApiKey: () => Promise<string>;
25
- getProjectSetup: () => Promise<ProjectSetup>;
26
- select: <T>(options: {
27
- message: string;
28
- choices: Array<{
29
- name: string;
30
- value: T;
31
- disabled?: boolean;
32
- }>;
33
- }) => Promise<T>;
34
- input: (options: {
35
- message: string;
36
- default?: string;
37
- }) => Promise<string>;
38
- confirm: (options: {
39
- message: string;
40
- default?: boolean;
41
- }) => Promise<boolean>;
42
- selectProject: (projectService: ProjectService) => Promise<ProjectSelection>;
43
- };
44
- export {};