champollion 0.3.4 → 0.4.0
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/README.md +41 -26
- package/bin/cli.js +53 -5
- package/index.js +63 -2
- package/lib/api-key.js +17 -4
- package/lib/autofix.js +83 -36
- package/lib/bridge/method_bridge.py +15 -3
- package/lib/cards/reader.js +34 -0
- package/lib/cards/remote.js +15 -0
- package/lib/cards/search-names.js +178 -0
- package/lib/command-help.js +286 -85
- package/lib/commands/audit.js +10 -3
- package/lib/commands/card.js +583 -226
- package/lib/commands/doctor.js +54 -18
- package/lib/commands/help.js +37 -32
- package/lib/commands/init.js +1689 -87
- package/lib/commands/integrity.js +127 -40
- package/lib/commands/leaderboard.js +187 -67
- package/lib/commands/models.js +9 -2
- package/lib/commands/provenance.js +7 -2
- package/lib/commands/recommend.js +43 -14
- package/lib/commands/register-corpus.js +632 -125
- package/lib/commands/seal-corpus.js +1 -1
- package/lib/commands/status.js +564 -27
- package/lib/commands/submit.js +17 -12
- package/lib/commands/sync.js +31 -7
- package/lib/commands/tm.js +15 -9
- package/lib/commands/verify.js +27 -3
- package/lib/commands/wrap.js +63 -5
- package/lib/commands/xliff.js +135 -64
- package/lib/commercial-eligibility.js +1 -1
- package/lib/config.js +196 -14
- package/lib/content-estimate.js +96 -0
- package/lib/content-refusals.js +270 -0
- package/lib/content-review.js +372 -0
- package/lib/content-sync.js +1127 -344
- package/lib/content.js +94 -7
- package/lib/corpus-registration.mjs +194 -35
- package/lib/cost-label.js +29 -0
- package/lib/cost-report.js +726 -78
- package/lib/diff.js +38 -4
- package/lib/docusaurus-sync.js +965 -253
- package/lib/edit-distance.js +31 -0
- package/lib/fallback.js +964 -0
- package/lib/file-scope.js +106 -0
- package/lib/flatten.js +80 -3
- package/lib/flutter-locales.js +124 -0
- package/lib/format.js +266 -12
- package/lib/hash.js +146 -21
- package/lib/icu-structure.js +929 -0
- package/lib/integrity.js +223 -75
- package/lib/language-pair.js +157 -0
- package/lib/lint.js +78 -16
- package/lib/local-only-marks.js +106 -0
- package/lib/locale-layout.js +1103 -0
- package/lib/locale-state.js +571 -0
- package/lib/methods/anthropic.js +5 -0
- package/lib/methods/apertium.js +6 -3
- package/lib/methods/api.js +138 -25
- package/lib/methods/base.js +17 -0
- package/lib/methods/coaching-data.js +153 -0
- package/lib/methods/content-separator.js +43 -0
- package/lib/methods/deepl.js +1 -1
- package/lib/methods/direct-llm.js +252 -103
- package/lib/methods/external.js +146 -63
- package/lib/methods/gemini.js +1 -0
- package/lib/methods/google-translate.js +1 -0
- package/lib/methods/http-utils.js +41 -0
- package/lib/methods/libretranslate.js +7 -2
- package/lib/methods/llm-coached.js +68 -128
- package/lib/methods/llm.js +80 -31
- package/lib/methods/local.js +93 -10
- package/lib/methods/microsoft-translator.js +1 -2
- package/lib/methods/openai.js +4 -2
- package/lib/methods/openrouter-client.js +20 -19
- package/lib/methods/openrouter-pricing.js +150 -13
- package/lib/methods/prompt-methods.js +20 -0
- package/lib/methods/provider-pricing.js +42 -1
- package/lib/methods/request-capture.js +104 -0
- package/lib/methods/tilde.js +1 -1
- package/lib/methods/translated.js +1 -2
- package/lib/missing-key.js +93 -0
- package/lib/models.js +11 -0
- package/lib/name-rules.js +32 -0
- package/lib/named-keys.js +172 -0
- package/lib/no-translate.js +4 -3
- package/lib/output.js +160 -19
- package/lib/pairs.js +586 -30
- package/lib/placeholders.js +394 -0
- package/lib/plugins.js +8 -0
- package/lib/plural-gap-redo.js +109 -0
- package/lib/plurals.js +323 -0
- package/lib/po.js +1187 -0
- package/lib/public-catalogue.js +74 -0
- package/lib/recommend.js +527 -32
- package/lib/redo.js +95 -0
- package/lib/refusal-category.js +44 -0
- package/lib/registers.js +255 -11
- package/lib/repair-script.js +20 -13
- package/lib/scripts.js +6 -1
- package/lib/seal.mjs +4 -3
- package/lib/sealed-qualifier.mjs +1 -1
- package/lib/segment.js +2 -1
- package/lib/seo.js +19 -9
- package/lib/serve.js +43 -6
- package/lib/shared-output-seed.js +164 -0
- package/lib/source-contexts.js +39 -0
- package/lib/submit.mjs +57 -5
- package/lib/sync.js +2923 -474
- package/lib/terminology.js +13 -4
- package/lib/tm-evict.js +179 -0
- package/lib/tm-seed.js +5 -2
- package/lib/tm.js +818 -36
- package/lib/translate-pair.js +639 -34
- package/lib/translate.js +78 -5
- package/lib/types.js +22 -3
- package/lib/validate.js +880 -17
- package/lib/verify.js +1296 -104
- package/lib/watch.js +32 -13
- package/lib/xliff.js +44 -3
- package/package.json +1 -1
- package/shared/CORPORA-CARDS.md +2 -0
- package/shared/cards-fallback.json +1 -1
- package/shared/curated-orthography-conventions.json +26 -8
- package/shared/gettext-plural-forms.json +45 -0
- package/shared/method-registry.json +2 -0
- package/shared/metric-registry.json +96 -18
- package/shared/schemas/champollion-plugin.schema.json +4 -0
- package/shared/schemas/corpora-card.schema.json +8 -2
- package/shared/schemas/method-index-record.schema.json +67 -0
- package/shared/schemas/method-registry.schema.json +4 -0
- package/shared/schemas/metric-registry.schema.json +55 -1
- package/shared/docent/corpus.json +0 -11739
package/lib/diff.js
CHANGED
|
@@ -130,15 +130,49 @@ function diffLocale(sourceFlat, targetFlat, fallbackPrefix = '[EN] ', forceKeys
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
-
*
|
|
133
|
+
* The queue's reasons with each key under ONE of them — the first that
|
|
134
|
+
* applies, in this order: missing, [EN] fallback, untranslated (source
|
|
135
|
+
* echo), changed, forced. A key named for a redo that is also missing is
|
|
136
|
+
* "missing" (Round 10, i18next persona: verify's one-key repair was logged
|
|
137
|
+
* "1 missing + 1 forced"). `diff` itself keeps the full lists — the named
|
|
138
|
+
* keys still drive what a redo replaces.
|
|
139
|
+
*
|
|
140
|
+
* @param {{ missing: string[], needsTranslation: string[], untranslated?: string[], changed?: string[], forced?: string[] }} diff
|
|
141
|
+
* @returns {{ missing: string[], needsTranslation: string[], untranslated: string[], changed: string[], forced: string[] }}
|
|
142
|
+
*/
|
|
143
|
+
function queueReasons(diff) {
|
|
144
|
+
const seen = new Set();
|
|
145
|
+
const take = (keys) => (keys || []).filter((k) => {
|
|
146
|
+
if (seen.has(k)) return false;
|
|
147
|
+
seen.add(k);
|
|
148
|
+
return true;
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
missing: take(diff.missing),
|
|
152
|
+
needsTranslation: take(diff.needsTranslation),
|
|
153
|
+
untranslated: take(diff.untranslated),
|
|
154
|
+
changed: take(diff.changed),
|
|
155
|
+
forced: take(diff.forced),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Generate a human-readable label for the diff result. Each queued key is
|
|
161
|
+
* counted once, under its first reason (queueReasons).
|
|
134
162
|
*
|
|
135
163
|
* @param {import('./types.js').DiffResult} diff - Diff result from diffLocale
|
|
136
164
|
* @returns {string} Human-readable summary (e.g., '3 missing + 1 [EN] fallback(s)')
|
|
137
165
|
*/
|
|
138
166
|
function diffLabel(diff) {
|
|
139
|
-
const {
|
|
167
|
+
const { noTranslate } = diff;
|
|
168
|
+
const { missing, needsTranslation, untranslated, changed, forced } = queueReasons(diff);
|
|
140
169
|
const parts = [];
|
|
141
|
-
|
|
170
|
+
// gettext entries flagged fuzzy read as missing (lib/po.js); the caller
|
|
171
|
+
// passes them as `fuzzy` (a subset of `missing`) so they are named as such.
|
|
172
|
+
const fuzzy = (diff.fuzzy || []).filter(k => missing.includes(k));
|
|
173
|
+
const absent = missing.length - fuzzy.length;
|
|
174
|
+
if (absent > 0) parts.push(`${absent} missing`);
|
|
175
|
+
if (fuzzy.length > 0) parts.push(`${fuzzy.length} fuzzy (source changed — ${diff.fuzzyVerb || 're-translating'})`);
|
|
142
176
|
if (needsTranslation.length > 0) parts.push(`${needsTranslation.length} [EN] fallback(s)`);
|
|
143
177
|
if (untranslated && untranslated.length > 0) parts.push(`${untranslated.length} untranslated`);
|
|
144
178
|
if (changed && changed.length > 0) parts.push(`${changed.length} changed`);
|
|
@@ -152,4 +186,4 @@ function diffLabel(diff) {
|
|
|
152
186
|
return 'fully synced';
|
|
153
187
|
}
|
|
154
188
|
|
|
155
|
-
export { diffLocale, diffLabel };
|
|
189
|
+
export { diffLocale, diffLabel, queueReasons };
|