-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Fix handling for pt_BR and pt_PT #125
Comments
It doesn't accept pt_BR as specified language? |
Nope, we do a split on |
@MasterOdin |
There are two parts to this. The first is that we need to rewrite the language setting stuff such that we do not trim down to just the two character code in all cases (so we retain if someone set For both, I almost think the best solution (imo) would be to fetch the index.json file (https://tldr.sh/assets/index.json) and then use that to determine the list of possible platform and languages to search through. However, I think we can also (right now) bypass this step by just operating on the simple belief that except for As such, I would probably modify things such that we change the def get_language_list():
lang = os.environ.get('LANG', '')
languages = os.environ.get('LANGUAGE', '').split(':')
# per spec, this needs to be set to something other than C or empty, to
# enable languages
if lang in ['C', '']:
return 'en'
languages.append(lang)
languages.append('en')
final_set = []
for lang in languages:
if lang in ['POSIX', 'C', '']:
continue
if lang == 'pt':
lang = 'pt_PT'
if lang not in ['pt_PT', 'pt_BR', 'zh_TW']:
lang = lang.split('_')[0]
final_set.append(lang)
return final_set |
I guess for these 3 cases a simple case handling is sufficient. I would also prefer your solution, but to parse the json, i would prefer a jsonpath library. The only widespread available I could found would be jsonpath-rw, which is available on almost all mainstream distros except arch, where it is available in the aur. Your sketch would be the most viable option. |
While most languages only use the
ll
bit of thell_CC
language specification, Portuguese is split using the full code to differentiate between Brazilian and Portugal Portuguese, which is currently not supported by the client.The text was updated successfully, but these errors were encountered: