ardaku/whoami

Language Handling

AldaronLau opened this issue · 3 comments

Currently, on Unix-like platforms for English speakers in the US, something along the lines of ["en-US", "en"] will be reported by lang(). On Windows, just ["en-US"] will be reported. How should language fallbacks be expected to be handled? It would be nice to have some kind of consistency here.

Not sure on exact language tags, but for example, if the user prefers ["en-CN", "en-GB", "zh-CN"], then I'm assuming that if all else fails, they would prefer next (for fallback) ["en", "zh"] (requesting any dialect for English first, then any dialect of Chinese second). But, the question is whether or not whoami should append these any dialect language codes?

I think the answer to this question depends on whether or not it's supported to select "any" dialect from the OS dialogues (needs some research).

Upon further research it appears as though it's possible to select "any", at least on Linux. WhoAmI should not automatically insert the language without the dialect. Although, since it is a fallback list, any dialect could be appended at the end of the list:

["en-CN", "en-GB", "zh-CN"] -> ["en-CN", "en-GB", "zh-CN", "en", "zh"]
["en-CN", "en", "zh-CN"] -> ["en-CN", "en", "zh-CN", "zh"]