mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Extend logging when determining default locale
This commit is contained in:
parent
3ad87e1362
commit
51c2352d67
1 changed files with 5 additions and 2 deletions
|
@ -107,15 +107,18 @@ public class Utils {
|
|||
public static Locale getDefaultLocale(Locale fallback) {
|
||||
final var locale = Locale.getDefault();
|
||||
if (locale == null) {
|
||||
logger.debug("No default locale found, using fallback: {}", fallback);
|
||||
return fallback;
|
||||
}
|
||||
final var localeString = locale.getLanguage() + "-" + locale.getCountry();
|
||||
try {
|
||||
Locale.LanguageRange.parse(locale.getLanguage() + "-" + locale.getCountry());
|
||||
Locale.LanguageRange.parse(localeString);
|
||||
} catch (IllegalArgumentException e) {
|
||||
logger.debug("Invalid locale, ignoring: {}", locale);
|
||||
logger.debug("Invalid locale '{}', using fallback: {}", locale, fallback);
|
||||
return fallback;
|
||||
}
|
||||
|
||||
logger.debug("Using default locale: {} ({})", locale, localeString);
|
||||
return locale;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue