changing cultureinfo on android using xamarin and c# -
im calling custom method dynamically switch current cultureinfo french "fr"
like after calling method android app still use default culture 'en' in debug mode culture seems ok. folder ok. have both , string values configured. folder: resource/values/strings.xml, resource/values-fr/strings.xml.
do need reload contentview or something? miss here?
private void setlocal(string lang) { system.threading.thread.currentthread.currentculture = new system.globalization.cultureinfo(lang); system.threading.thread.currentthread.currentuiculture = new system.globalization.cultureinfo(lang); }
i know it's bit late answer question found solution!! try works me:
string culturename = "fr-fr"; var locale = new java.util.locale(culturename); java.util.locale.default = locale; var config = new android.content.res.configuration { locale = locale }; basecontext.resources.updateconfiguration(config, basecontext.resources.displaymetrics);
Comments
Post a Comment