-
Notifications
You must be signed in to change notification settings - Fork 75
i18n: update coverage to auto-detect browser languages #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I think that option 2 is better from a logic standpoint, with a wrapper for pulling from browser export const localesToLang = (locales: readonly string[]): Lang => {
// ...
};
export const browserLanguagesToLang = (): Lang => localesToLang(navigator.languages);But this is pretty subjective. |
valarnin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because you cannot change the language setting of the ACT web browser
Can you file an issue on the OverlayPlugin repo for this and I'll see about tackling it towards the end of the expansion, if it's even possible?
#946) f285d76: `coverage.ts` detects language from the web browser. c0cf1de: fix Korean translation 8cbefb1: remove `languagesArr` parameter from `browserLanguagesToLang` function. ## Removing `languagesArr` parameter ### Current Situation The `browserLanguagesToLang` function has a comment saying it only takes `navigator.languages` as input. But it still receives this value as a parameter, which is unnecessary. ### Option 1: Remove the parameter If the function only handles `navigator.languages`, we can remove the parameter and use `navigator.languages` directly inside the function. ### Option 2: Generalize the function If we want to support other locale arrays beyond `navigator.languages`, we could keep the parameter and rename the function to `localesToLang`. This makes it clear that the function converts any locale array to a cactbot language. --- This PR implements Option 1. Let me know if Option 2 is preferred. e14eec1
OverlayPlugin#946) f285d76: `coverage.ts` detects language from the web browser. c0cf1de: fix Korean translation 8cbefb1: remove `languagesArr` parameter from `browserLanguagesToLang` function. ## Removing `languagesArr` parameter ### Current Situation The `browserLanguagesToLang` function has a comment saying it only takes `navigator.languages` as input. But it still receives this value as a parameter, which is unnecessary. ### Option 1: Remove the parameter If the function only handles `navigator.languages`, we can remove the parameter and use `navigator.languages` directly inside the function. ### Option 2: Generalize the function If we want to support other locale arrays beyond `navigator.languages`, we could keep the parameter and rename the function to `localesToLang`. This makes it clear that the function converts any locale array to a cactbot language. --- This PR implements Option 1. Let me know if Option 2 is preferred. e14eec1


f285d76:
coverage.tsdetects language from the web browser.c0cf1de: fix Korean translation
8cbefb1: remove
languagesArrparameter frombrowserLanguagesToLangfunction.Removing
languagesArrparameterCurrent Situation
The
browserLanguagesToLangfunction has a comment saying it only takesnavigator.languagesas input. But it still receives this value as a parameter, which is unnecessary.Option 1: Remove the parameter
If the function only handles
navigator.languages, we can remove the parameter and usenavigator.languagesdirectly inside the function.Option 2: Generalize the function
If we want to support other locale arrays beyond
navigator.languages, we could keep the parameter and rename the function tolocalesToLang. This makes it clear that the function converts any locale array to a cactbot language.This PR implements Option 1. Let me know if Option 2 is preferred.