Skip to content

Commit 6f22c25

Browse files
committed
🚧 Missing language translation fix
- Fix the `translation` function returning the translation key when a language that isn't supported is selected. It now returns the English translation if no language is found.
1 parent 4c37978 commit 6f22c25

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/util/translation.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import { default as LANGUAGES, filenames as filepaths } from '../lang/*.yml'
44
const FILE_NAMES = filepaths.map((path: string) => PathModule.basename(path, '.yml'))
55

66
export function translate(key: string, ...args: string[]) {
7-
const languageIndex = FILE_NAMES.indexOf(settings.language.value)
7+
let languageIndex = FILE_NAMES.indexOf(settings.language.value)
88
if (languageIndex === -1) {
99
console.warn(`Could not find language '${settings.language.value as string}'`)
10-
console.log(`Available languages: ${FILE_NAMES.join(', ') as string}`)
11-
return key
10+
languageIndex = FILE_NAMES.indexOf('en')
1211
}
1312
const lang = LANGUAGES[languageIndex] as Record<string, string>
1413
if (!key.startsWith('animated_java.')) {

0 commit comments

Comments
 (0)