Skip to content

Commit 363768e

Browse files
i18n lang detection: remove language variant from detected langs
If the browser reports en-US as the preferred language that was previously disregarded since it doesn't match any translations. This fix strips off the variant, i.e. the part after the dash, so en-US becomes en. Fixes #94
1 parent 8f13c69 commit 363768e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/renderer/i18n/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ void i18n
3838
// so we have to not keep any of the basic html nodes
3939
transKeepBasicHtmlNodesFor: [],
4040
},
41+
detection: {
42+
convertDetectedLanguage: (lng: string) => lng.split("-")[0],
43+
},
4144
});
4245

4346
export default i18n;

0 commit comments

Comments
 (0)