mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-17 04:59:34 +02:00
fix: create-tool.mjs to include i18n locales
This commit is contained in:
@@ -258,4 +258,30 @@ indexContent.splice(
|
|||||||
)} } from './${toolName}/meta';`
|
)} } from './${toolName}/meta';`
|
||||||
);
|
);
|
||||||
writeFile(toolsIndex, indexContent.join('\n'));
|
writeFile(toolsIndex, indexContent.join('\n'));
|
||||||
|
|
||||||
|
// Update locale JSON file
|
||||||
|
const localeFilePath = join(
|
||||||
|
currentDirname,
|
||||||
|
'..',
|
||||||
|
'public',
|
||||||
|
'locales',
|
||||||
|
'en',
|
||||||
|
`${i18nNamespace}.json`
|
||||||
|
);
|
||||||
|
|
||||||
|
let localeData = {};
|
||||||
|
if (fs.existsSync(localeFilePath)) {
|
||||||
|
const localeContent = await readFile(localeFilePath, { encoding: 'utf-8' });
|
||||||
|
localeData = JSON.parse(localeContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
localeData[toolNameCamelCase] = {
|
||||||
|
title: toolNameTitleCase,
|
||||||
|
description: '',
|
||||||
|
shortDescription: '',
|
||||||
|
longDescription: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
// Write updated locale file
|
||||||
|
await writeFile(localeFilePath, JSON.stringify(localeData, null, 2));
|
||||||
console.log(`Added import in: ${toolsIndex}`);
|
console.log(`Added import in: ${toolsIndex}`);
|
||||||
|
Reference in New Issue
Block a user