Add locale

This commit is contained in:
Victor Shcherb 2020-02-07 18:39:33 +01:00
parent 50a676b712
commit fe56004b66
3 changed files with 19 additions and 1 deletions

View file

@ -374,7 +374,15 @@ public class OsmandRegions {
}
public void setLocale(String locale) {
setLocale(locale, null);
}
public void setLocale(String locale, String country) {
this.locale = locale;
// Check locale and give 2 locale names
// if("zh".equals(locale) && "rTW".equals(country)) {
// this.locale = "zh-Hant";
// }
}

View file

@ -567,7 +567,7 @@ public class AppInitializer implements IProgress {
return null;
}
});
app.regions.setLocale(app.getLanguage());
app.regions.setLocale(app.getLanguage(), app.getCountry());
}

View file

@ -776,6 +776,16 @@ public class OsmandApplication extends MultiDexApplication {
}
}
public String getCountry() {
String country;
if (preferredLocale != null) {
country = preferredLocale.getCountry();
} else {
country = Locale.getDefault().getCountry();
}
return country;
}
public String getLanguage() {
String lang;
if (preferredLocale != null) {