Skip to content

Commit 69d5a02

Browse files
committed
fix: create-tool.mjs to include i18n locales
1 parent 89a509a commit 69d5a02

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

scripts/create-tool.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,30 @@ indexContent.splice(
258258
)} } from './${toolName}/meta';`
259259
);
260260
writeFile(toolsIndex, indexContent.join('\n'));
261+
262+
// Update locale JSON file
263+
const localeFilePath = join(
264+
currentDirname,
265+
'..',
266+
'public',
267+
'locales',
268+
'en',
269+
`${i18nNamespace}.json`
270+
);
271+
272+
let localeData = {};
273+
if (fs.existsSync(localeFilePath)) {
274+
const localeContent = await readFile(localeFilePath, { encoding: 'utf-8' });
275+
localeData = JSON.parse(localeContent);
276+
}
277+
278+
localeData[toolNameCamelCase] = {
279+
title: toolNameTitleCase,
280+
description: '',
281+
shortDescription: '',
282+
longDescription: ''
283+
};
284+
285+
// Write updated locale file
286+
await writeFile(localeFilePath, JSON.stringify(localeData, null, 2));
261287
console.log(`Added import in: ${toolsIndex}`);

0 commit comments

Comments
 (0)