forked from open-webui/open-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: auto add translation keys to json
Uses i18next-parser to automatically extract translation keys from js and svelte files.
- Loading branch information
1 parent
f55525c
commit 08aa60b
Showing
7 changed files
with
1,649 additions
and
1,621 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.