poly-lexis 0.8.0 → 0.8.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.
- package/dist/cli/translations.js +4 -2
- package/dist/cli/translations.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1212,12 +1212,14 @@ function extractPluralBaseKeys(keys) {
|
|
|
1212
1212
|
}
|
|
1213
1213
|
return Array.from(baseKeys);
|
|
1214
1214
|
}
|
|
1215
|
-
var typeTemplate = (translationKeys, namespaceKeys) => `
|
|
1215
|
+
var typeTemplate = (translationKeys, namespaceKeys, languages) => `
|
|
1216
1216
|
export const translationKeys = [${translationKeys.map((key) => `"${key}"`).join(", ")}] as const;
|
|
1217
1217
|
export const namespaceKeys = [${namespaceKeys.map((key) => `"${key}"`).join(", ")}] as const;
|
|
1218
|
+
export const languages = [${languages.map((lang) => `"${lang}"`).join(", ")}] as const;
|
|
1218
1219
|
|
|
1219
1220
|
export type TranslationKey = typeof translationKeys[number];
|
|
1220
1221
|
export type TranslationNamespace = typeof namespaceKeys[number];
|
|
1222
|
+
export type Language = typeof languages[number];
|
|
1221
1223
|
`;
|
|
1222
1224
|
function generateTranslationTypes(projectRoot = process.cwd()) {
|
|
1223
1225
|
console.log("=====");
|
|
@@ -1248,7 +1250,7 @@ function generateTranslationTypes(projectRoot = process.cwd()) {
|
|
|
1248
1250
|
if (!fs3.existsSync(outputDir)) {
|
|
1249
1251
|
fs3.mkdirSync(outputDir, { recursive: true });
|
|
1250
1252
|
}
|
|
1251
|
-
const typeString = typeTemplate(allKeys, namespaces);
|
|
1253
|
+
const typeString = typeTemplate(allKeys, namespaces, config.languages);
|
|
1252
1254
|
fs3.writeFileSync(outputFilePath, typeString, "utf8");
|
|
1253
1255
|
console.log(`Generated types with ${allKeys.length} keys and ${namespaces.length} namespaces`);
|
|
1254
1256
|
console.log(`Output: ${outputFilePath}`);
|