All my texts are in string.xml
files which in turn contained in the folders values-hi, values-en
. how to specify Locale marathi or please let me know the language specifier for values folder to fetch marathi strings
public void setLanguage(String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
Locale.getAvailableLocales();
if (checkForLocaleSupport(locale)) {
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
}
}
public boolean checkLocaleSupport(Locale locale){
Locale[] locs= Locale.getAvailableLocales();
for(Locale l:locs){
if(l.equals(locale)){
return true;
}
}
return false;
}
In oncreate() method of my main activity im setting language as setLanguage("hi") before setting the content. then after setting the content and intilisizing a textview im doing mHeaderText.setText(R.string.my_header); my header is read from string.xml in values-hi folder. but if I set language as "mr" , string is not fetched from values-mr folder. Greatly appreciate the help
To learn Marathi, start by listening to music, and watching movies and TV shows in Marathi to begin immersing yourself in the language. Next, use free online language databases like FluentU and Livemocha to start learning key phrases.
Marathi is the official spoken language in Maharashtra. It is also the fourth most spoken language, after Hindi, Bengali, and Telugu, in India. It ranks 19 in the list of most spoken languages in the world. Besides competitions in schools and colleges, cultural functions are also organised in offices and institutions.
Marathi is one of the easiest Indian languages to learn as writes exactly the way it speaks. You will also pick up Hindi and Sanskrit along with it. All you have to do is just twist some words and learn a little syntax. Learn the Devanagari script and you know the language much more than you think.
So it shoudl be values-mr
for your folder from the 2 links I gave you in comments.
Edit: relevant links : http://developer.android.com/reference/java/util/Locale.html
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With