mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Fixing the nearbyController default language
Also fixes the settingsFragment to select different primary and secondary description labels.
This commit is contained in:
parent
1d479f0da7
commit
4db858946a
2 changed files with 13 additions and 3 deletions
|
|
@ -147,7 +147,8 @@ public class NearbyController extends MapController {
|
||||||
*/
|
*/
|
||||||
public List<Place> getPlaces(List<Place> placeList) throws Exception {
|
public List<Place> getPlaces(List<Place> placeList) throws Exception {
|
||||||
String secondaryLanguages = defaultKvStore.getString(Prefs.SECONDARY_LANGUAGES, "");
|
String secondaryLanguages = defaultKvStore.getString(Prefs.SECONDARY_LANGUAGES, "");
|
||||||
return nearbyPlaces.getPlaces(placeList, Locale.getDefault().getLanguage(), secondaryLanguages);
|
String primaryLanguage = defaultKvStore.getString(Prefs.DESCRIPTION_LANGUAGE, "");
|
||||||
|
return nearbyPlaces.getPlaces(placeList, primaryLanguage, secondaryLanguages);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LatLng calculateNorthEast(double latitude, double longitude, double distance) {
|
public static LatLng calculateNorthEast(double latitude, double longitude, double distance) {
|
||||||
|
|
|
||||||
|
|
@ -309,14 +309,23 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
private fun prepareSecondaryLanguagesDialog() {
|
private fun prepareSecondaryLanguagesDialog() {
|
||||||
val languageCode = getCurrentLanguageCode("descriptionSecondaryLanguagesPref")
|
val languageCode = getCurrentLanguageCode("descriptionSecondaryLanguagesPref")
|
||||||
|
val defaultCode = getCurrentLanguageCode("descriptionDefaultLanguagePref")
|
||||||
val selectedLanguages = hashMapOf<Int, String>()
|
val selectedLanguages = hashMapOf<Int, String>()
|
||||||
|
|
||||||
|
var deflocale = Locale.getDefault()
|
||||||
|
|
||||||
|
|
||||||
|
if (defaultCode != null){
|
||||||
|
deflocale = createLocale(defaultCode)
|
||||||
|
}
|
||||||
|
|
||||||
languageCode?.let {
|
languageCode?.let {
|
||||||
selectedLanguages[0] = Locale.getDefault().language
|
selectedLanguages[0] = deflocale.language
|
||||||
}
|
}
|
||||||
|
|
||||||
val savedLanguages = arrayListOf<Language>()
|
val savedLanguages = arrayListOf<Language>()
|
||||||
languageCode?.split(",\\s*".toRegex())?.forEach { code ->
|
languageCode?.split(",\\s*".toRegex())?.forEach { code ->
|
||||||
if (code != Locale.getDefault().language) {
|
if (code != deflocale.language) {
|
||||||
val locale = Locale(code)
|
val locale = Locale(code)
|
||||||
savedLanguages.add(Language(locale.displayLanguage, code))
|
savedLanguages.add(Language(locale.displayLanguage, code))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue