@ultimat3/i18n 31.31.0 → 31.32.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/package.json +2 -2
- package/src/errors.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/i18n",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.32.0",
|
|
4
4
|
"description": "Dependency-free translator, catalog flattening, locale negotiation and loud missing-key rendering",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -48,6 +48,6 @@
|
|
|
48
48
|
"test": "bun test"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@ultimat3/core": "31.
|
|
51
|
+
"@ultimat3/core": "31.32.0"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/src/errors.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Every throw carries a stable code, a cause, and a command that fixes it.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { registerErrorCodes, UltimateError } from '@ultimat3/core';
|
|
6
|
+
import { registerErrorCodes, renderFixShellArg, UltimateError } from '@ultimat3/core';
|
|
7
7
|
|
|
8
8
|
export const I18N_ERROR_CODES = [
|
|
9
9
|
'X_LOCALE_UNSUPPORTED',
|
|
@@ -44,7 +44,7 @@ export function localeUnsupported(tag: string, supported: readonly string[]): I1
|
|
|
44
44
|
return new I18nError({
|
|
45
45
|
code: 'X_LOCALE_UNSUPPORTED',
|
|
46
46
|
cause: `locale "${tag}" is not in the supported set [${supported.join(', ')}]`,
|
|
47
|
-
fix: `x i18n add ${normalizeForFix(tag)}`,
|
|
47
|
+
fix: `x i18n add ${renderFixShellArg(normalizeForFix(tag), '<locale>')}`,
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -58,7 +58,7 @@ export function catalogMissingKeys(locale: string, keys: readonly string[]): I18
|
|
|
58
58
|
return new I18nError({
|
|
59
59
|
code: 'X_CATALOG_MISSING_KEYS',
|
|
60
60
|
cause: `packages/i18n/catalogs/${locale}.json is missing ${keys.length} key(s) source names or the reference locale defines: ${shown.join(', ')}${suffix}`,
|
|
61
|
-
fix: `x i18n sync ${locale} # writes each key above as ⟦key⟧ — replace every one with the real string`,
|
|
61
|
+
fix: `x i18n sync ${renderFixShellArg(locale, '<locale>')} # writes each key above as ⟦key⟧ — replace every one with the real string`,
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -116,7 +116,7 @@ export function catalogsNeverRegistered(locale: string, unresolved: readonly str
|
|
|
116
116
|
return new I18nError({
|
|
117
117
|
code: 'X_CATALOG_UNREGISTERED',
|
|
118
118
|
cause: `no catalog is registered for "${locale}" and ${unresolved.length} key(s) used in source resolve to nothing: ${shownKeys(unresolved)} — each renders \u27e6key\u27e7`,
|
|
119
|
-
fix: `x i18n add ${locale} # then ${REGISTRATION_FIX}`.trim(),
|
|
119
|
+
fix: `x i18n add ${renderFixShellArg(locale, '<locale>')} # then ${REGISTRATION_FIX}`.trim(),
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
|