mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-11-05 16:34:57 +05:30
fix: create-tool.mjs to include i18n locales
This commit is contained in:
parent
89a509a13e
commit
69d5a02c73
1 changed files with 26 additions and 0 deletions
|
|
@ -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}`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue