Commit 4bec9ef 1 parent 107facd commit 4bec9ef Copy full SHA for 4bec9ef
File tree 1 file changed +8
-11
lines changed
library/src/main/java/de/westnordost/osmfeatures
1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -112,17 +112,14 @@ private List<LocalizedFeature> loadLocalizedFeaturesList(Locale locale)
112
112
113
113
private static String getLocalizationFilename (Locale locale )
114
114
{
115
- /* not simply locale.toLanguageTag() because Locale may contain other stuff (variants etc)
116
- that are not supported */
117
- String lang = locale .getLanguage ();
118
- String country = locale .getCountry ();
119
- String script = locale .getScript ();
120
-
121
- StringBuilder builder = new StringBuilder (lang );
122
- if (!script .isEmpty ()) builder .append ("-" ).append (script );
123
- if (!country .isEmpty ()) builder .append ("-" ).append (country );
124
- builder .append (".json" );
125
- return builder .toString ();
115
+ /* we only want language+country+script of the locale, not anything else. So we construct
116
+ it anew here */
117
+ return new Locale .Builder ()
118
+ .setLanguage (locale .getLanguage ())
119
+ .setRegion (locale .getCountry ())
120
+ .setScript (locale .getScript ())
121
+ .build ()
122
+ .toLanguageTag () + ".json" ;
126
123
}
127
124
128
125
private static List <Locale > getLocaleComponents (Locale locale )
You can’t perform that action at this time.
0 commit comments