'i18Next: use locale only for some languages and use language + location for rest

I have a question for the i18next library. If I have these set of locales that are possible to be detected from the browser,

de
en-US
es
fr
it
ja
ko
pt-br
zh-cn
zh-tw

Is there a way to configure it where it respects the language only for some locales and not the other? for example, when it comes to en-US, I wish for the loaded language to be en so when I call the .language or .languages method, it will contain en instead of en-US. However, for the other locales that have a dash like pt-br, zh-cn, and zh-tw, they will remain untouched, (so NOT return just zh).

Is this possible?

thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source