mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 03:17:46 +01:00
feat: auto add translation keys to json
Uses i18next-parser to automatically extract translation keys from js and svelte files.
This commit is contained in:
38
i18next-parser.config.ts
Normal file
38
i18next-parser.config.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
// i18next-parser.config.ts
|
||||
import { getLanguages } from './src/lib/i18n/index.ts';
|
||||
|
||||
const getLangCodes = async () => {
|
||||
const languages = await getLanguages();
|
||||
return languages.map((l) => l.code);
|
||||
};
|
||||
|
||||
export default {
|
||||
contextSeparator: '_',
|
||||
createOldCatalogs: false,
|
||||
defaultNamespace: 'translation',
|
||||
defaultValue: '',
|
||||
indentation: 2,
|
||||
keepRemoved: false,
|
||||
keySeparator: false,
|
||||
lexers: {
|
||||
svelte: ['JavascriptLexer'],
|
||||
js: ['JavascriptLexer'], // if you're writing jsx inside .js files, change this to JsxLexer
|
||||
ts: ['JavascriptLexer'],
|
||||
|
||||
default: ['JavascriptLexer']
|
||||
},
|
||||
lineEnding: 'auto',
|
||||
locales: await getLangCodes(),
|
||||
namespaceSeparator: false,
|
||||
output: 'src/lib/i18n/locales/$LOCALE/$NAMESPACE.json',
|
||||
pluralSeparator: '_',
|
||||
input: 'src/**/*.{js,svelte}',
|
||||
sort: true,
|
||||
verbose: true,
|
||||
failOnWarnings: false,
|
||||
failOnUpdate: false,
|
||||
customValueTemplate: null,
|
||||
resetDefaultValueLocale: null,
|
||||
i18nextOptions: null,
|
||||
yamlOptions: null
|
||||
};
|
||||
Reference in New Issue
Block a user