on macOS, try to fix weird language preference handling

If the user has en_XX, consider that as untranslated english EXCEPT for en_GB
This commit is contained in:
Paul Davis 2022-11-28 10:17:28 -07:00
parent a7d2718aa4
commit c19f3f07b0

View file

@ -99,17 +99,26 @@ set_language_preference ()
*/
have_translatable_languages = false;
cout << "User has en as primary language choice. " << PROGRAM_NAME << " will not be translated\n";
} else if (len == 5 && cstr[len-2] == 'G' && cstr[len-1] == 'B') {
/* primary language is english (GB). Stop
looking, because we know there is a
translation.
*/
cout << "Use has en_GB a primary language choice. " << PROGRAM_NAME << " will be translated\n";
} else if (len == 5 && cstr[len-2] == 'U' && cstr[len-1] == 'S') {
/* primary language choice is english (US). Stop looking, and do not set
LANGUAGE. gettext needs to just skip translation entirely.
*/
have_translatable_languages = false;
cout << "User has en_US as primary language choice. " << PROGRAM_NAME << " will not be translated\n";
} else {
/* primary language choice is english with some
* non-anglosphere locale, eg. en_DE. We will
* not translate.
*/
have_translatable_languages = false;
cout << "User has " << cstr << " as primary language/locale choice. " << PROGRAM_NAME << " will not be translated\n";
}
/* else en-<FOO> ... still leave the door open for translation
to other version of english (e.g. en_IN, en_GB, etc)
*/
}
if (have_translatable_languages) {