I was trying to clean some warnings in my Android Eclipse project and I came across the one complaining on the implicit locale. I understand how to fix the warning but thinking about it I realized that if I develop an Android app with English as default language and the user selects another language that my app is not providing translation for then having something like
str = getString(R.string.myString);
Locale userLocale = Locale.getDefault();
str.toLowerCase(userLocale);
may not work properly as the locale may not match the current language for str, that would be in English. In addition, I cannot assume str will be always in English if I have more languages implemented adding the file values-XX/string.xml
(where XX is the contraction of other languages: "de" for German, "es" for Spanish...).
Then in order to fix this properly I would like to know if there is any way to know in which locale/language is the string that I am retrieving on calling Resources.getString()
and not the locale selected by the user (that can be retrieved by Locale.getDefault()
).