-
Notifications
You must be signed in to change notification settings - Fork 161
Language selection issues #101
Description
I'm submitting a…
- bug report
- feature request
- other
Short description of the issue/suggestion:
Two issues with the language detection for the international dialogues:
- There are systems where the key 'AppleLocale' is not set in the 'Apple Global Domain', leading to the error
The domain/default pair of (kCFPreferencesAnyApplication, AppleLocale) does not exist - Anyway, the Locale is not necessarily the active language. Like with e.g. a mexican locale, that might be set to english as preferred language.
What is the expected behavior?
Language should be chosen after the Preferred Languages as configured in System Preferences / Language & Region. Ideally following the prioritisation given by the order of languages in the list.
What is the current behavior?
Language will be chosen after the Locale (which might or might not be the same as the preferred language) or fall back to english if that fails.
What is the motivation / use case for changing the behavior?
Choosing the correct language
Getting rid of the error message
Please tell us about your environment:
- universalJavaApplicationStub version: 3.1.0
- Mac OS version: 10.14.6 (18G8012)
- Java version(s): Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Other information (e.g. related issues, suggestions how to fix, links for us to have context)
The quick and dirty fix is to remove line 337, so that line 338
stub_logger "[Language] $LANG"
will simply use the value of the environment variable $LANG. On my system that gave de_AT.UTF-8 in the sh version, but probably empty in the App environment.
Better fix: instead of 'AppleLocale' get the language array:
defaults read -g AppleLanguages [resulted in ( "de-AT", "en-AT" ) on my system]
If there is more than one item in the list, iterate through the entries, checking the first 2 cars of each against the list of available languages (fr, de, zh, es, en) until a match is found, and continue with that language code.