@babelize/engine 0.1.0 → 0.1.3
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.
- package/dist/analysis/analyze.js +1 -1
- package/dist/detection/stack.d.ts +42 -0
- package/dist/detection/stack.js +277 -0
- package/dist/django/catalog.d.ts +92 -0
- package/dist/django/catalog.js +677 -0
- package/dist/django/extract.d.ts +20 -0
- package/dist/django/extract.js +79 -0
- package/dist/django/inject-file.d.ts +6 -0
- package/dist/django/inject-file.js +52 -0
- package/dist/django/inject.d.ts +11 -0
- package/dist/django/inject.js +205 -0
- package/dist/django/keys.d.ts +21 -0
- package/dist/django/keys.js +63 -0
- package/dist/django/locale-names.d.ts +13 -0
- package/dist/django/locale-names.js +60 -0
- package/dist/django/mo-file.d.ts +6 -0
- package/dist/django/mo-file.js +60 -0
- package/dist/django/plural-forms.d.ts +34 -0
- package/dist/django/plural-forms.js +216 -0
- package/dist/django/po-file.d.ts +38 -0
- package/dist/django/po-file.js +273 -0
- package/dist/django/python-extract.d.ts +34 -0
- package/dist/django/python-extract.js +619 -0
- package/dist/django/python-lexer.d.ts +65 -0
- package/dist/django/python-lexer.js +398 -0
- package/dist/django/template-extract.d.ts +32 -0
- package/dist/django/template-extract.js +680 -0
- package/dist/django/types.d.ts +49 -0
- package/dist/django/types.js +15 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +16 -2
- package/dist/local/pseudo-provider.js +5 -4
- package/dist/local/translate-core.d.ts +5 -2
- package/dist/local/translate-core.js +43 -5
- package/dist/local/translate-messages.js +7 -9
- package/dist/modules/extractor/extract.js +22 -14
- package/dist/modules/finalization/django-finalize.d.ts +15 -0
- package/dist/modules/finalization/django-finalize.js +156 -19
- package/dist/modules/finalization/finalize.d.ts +2 -0
- package/dist/modules/finalization/finalize.js +58 -30
- package/dist/modules/finalization/nextjs-finalize.d.ts +4 -1
- package/dist/modules/finalization/nextjs-finalize.js +8 -9
- package/dist/modules/finalization/writes.d.ts +29 -0
- package/dist/modules/finalization/writes.js +78 -0
- package/dist/modules/format-injection/index.js +3 -2
- package/dist/modules/glossary/index.d.ts +1 -2
- package/dist/modules/glossary/index.js +14 -6
- package/dist/modules/glossary/rules.d.ts +81 -0
- package/dist/modules/glossary/rules.js +244 -0
- package/dist/modules/injection/inject.js +14 -30
- package/dist/modules/keygen/keygen.js +7 -0
- package/dist/modules/locale-builder/locales.js +23 -0
- package/dist/modules/lockfile/index.d.ts +1 -1
- package/dist/modules/lockfile/index.js +2 -1
- package/dist/modules/lockfile/lockfile-manager.d.ts +9 -0
- package/dist/modules/lockfile/lockfile-manager.js +16 -1
- package/dist/modules/lockfile/schema.d.ts +42 -0
- package/dist/modules/lockfile/schema.js +11 -0
- package/dist/modules/translator/icu-branches.d.ts +138 -0
- package/dist/modules/translator/icu-branches.js +393 -0
- package/dist/modules/translator/translate.d.ts +40 -4
- package/dist/modules/translator/translate.js +297 -173
- package/dist/modules/workspace/validate.js +67 -32
- package/dist/orchestrator.d.ts +5 -0
- package/dist/orchestrator.js +125 -14
- package/dist/providers/types.d.ts +10 -2
- package/dist/qa/check-project.d.ts +2 -1
- package/dist/qa/check-project.js +50 -7
- package/dist/qa/gettext-files.d.ts +15 -0
- package/dist/qa/gettext-files.js +115 -0
- package/dist/qa/locale-qa.js +20 -3
- package/dist/runtime/config.js +1 -0
- package/dist/runtime/types.d.ts +64 -0
- package/dist/utils/extraction-options.d.ts +9 -3
- package/dist/utils/extraction-options.js +13 -3
- package/dist/utils/file-utils.js +7 -2
- package/dist/utils/icu-message.d.ts +2 -2
- package/dist/utils/icu-message.js +43 -7
- package/dist/utils/jsx-message.js +7 -0
- package/dist/utils/metadata.d.ts +4 -2
- package/dist/utils/metadata.js +16 -10
- package/dist/utils/not-injected.js +2 -0
- package/dist/utils/placeholder-protection.d.ts +18 -1
- package/dist/utils/placeholder-protection.js +58 -13
- package/dist/utils/translation-sanitizer.d.ts +1 -0
- package/dist/utils/translation-sanitizer.js +23 -9
- package/dist/utils/translator-load-balancer.js +5 -1
- package/dist/utils/untranslated.d.ts +15 -0
- package/dist/utils/untranslated.js +34 -0
- package/package.json +2 -6
- package/dist/injection/django/django-template-injector.d.ts +0 -29
- package/dist/injection/django/django-template-injector.js +0 -216
- package/dist/modules/glossary/glossary.d.ts +0 -9
- package/dist/modules/glossary/glossary.js +0 -27
- package/dist/modules/glossary/masker.d.ts +0 -23
- package/dist/modules/glossary/masker.js +0 -56
- package/dist/modules/locale-builder/po.d.ts +0 -33
- package/dist/modules/locale-builder/po.js +0 -131
- package/dist/modules/translator/translator.d.ts +0 -5
- package/dist/modules/translator/translator.js +0 -46
- package/dist/utils/dtl-mask.d.ts +0 -25
- package/dist/utils/dtl-mask.js +0 -58
- package/dist/utils/py-extractor.d.ts +0 -14
- package/dist/utils/py-extractor.js +0 -285
|
@@ -1,16 +1,52 @@
|
|
|
1
1
|
import type { LocaleFile, WorkspaceInfo } from '../../runtime/types';
|
|
2
2
|
import type { ByokProvider } from '@babelize/types';
|
|
3
|
-
import
|
|
3
|
+
import { type GlossaryRules } from '../glossary';
|
|
4
|
+
import type { EngineProviders, ProjectRulesStore, TranslationFailure, TranslationCache } from '../../providers/types';
|
|
4
5
|
/** QA note on keys the backup (NLLB) translator produced. */
|
|
5
6
|
export declare const FALLBACK_QA_WARNING = "translated with the backup translator; will be retried with the AI translator next run";
|
|
6
7
|
export interface TranslateOptions {
|
|
7
8
|
/**
|
|
8
|
-
* The project's runtime formats ICU (next-intl, react-i18next + i18next-icu)
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* The project's runtime formats ICU (next-intl, react-i18next + i18next-icu):
|
|
10
|
+
* a translation may turn a count placeholder into an ICU plural. An LLM
|
|
11
|
+
* decides per message; for a plain-text translator (NLLB) the plural is
|
|
12
|
+
* built branch by branch for languages with more than one plural category.
|
|
13
|
+
* Otherwise a plain source must stay plain.
|
|
11
14
|
*/
|
|
12
15
|
targetPlurals?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Per key: literal text in an ICU plural's branches that stands for the
|
|
18
|
+
* plural's value besides `#` (a gettext plural turned into ICU keeps its
|
|
19
|
+
* `%(count)d`). Lets a plain-text translator inflect each branch.
|
|
20
|
+
*/
|
|
21
|
+
pluralValuePlaceholders?: Record<string, string>;
|
|
22
|
+
/**
|
|
23
|
+
* The project's glossary and brand voice, already loaded (the orchestrator
|
|
24
|
+
* loads them once to partition the lockfile). Loaded here when absent.
|
|
25
|
+
*/
|
|
26
|
+
rules?: LoadedTranslationRules;
|
|
27
|
+
/**
|
|
28
|
+
* Running count of fresh primary-translator translations, bumped as each
|
|
29
|
+
* batch lands (when it is also written to the cache and TM). Lets a run
|
|
30
|
+
* stopped mid-translation bill what it already produced.
|
|
31
|
+
*/
|
|
32
|
+
progress?: {
|
|
33
|
+
freshTranslations: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface LoadedTranslationRules {
|
|
37
|
+
glossary: GlossaryRules;
|
|
38
|
+
brandVoice: string | null;
|
|
39
|
+
/** False if the glossary or brand voice failed to load. */
|
|
40
|
+
complete: boolean;
|
|
13
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Load a project's glossary and brand voice. Never throws: a failure means
|
|
44
|
+
* translating without that rule, as before. The two lookups are independent,
|
|
45
|
+
* so a glossary failure doesn't also drop the brand voice. `complete` is false
|
|
46
|
+
* if either failed — callers that copy text into shared TM must then assume
|
|
47
|
+
* project-specific wording may be baked in.
|
|
48
|
+
*/
|
|
49
|
+
export declare function loadProjectTranslationRules(projectId: string, rules?: ProjectRulesStore): Promise<LoadedTranslationRules>;
|
|
14
50
|
export declare function translateLocales(workspace: WorkspaceInfo, sourceLocale: LocaleFile, targetLocales: string[], forceTranslation?: boolean, dryRun?: boolean, projectId?: string, onProgress?: (message: string) => void, keysToTranslateByLocale?: Record<string, string[]>, cacheProvider?: TranslationCache, byokConfig?: {
|
|
15
51
|
provider: ByokProvider;
|
|
16
52
|
apiKey: string;
|