I have my UWP app localized to English and German. However if I run the app the language changes properly. But when I give a release build the language doesn't change.
This is the code where I set the language to preferred language.
var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
if (localSettings.Values.ContainsKey("LanguagePreference"))
{
selectedLanguage = (string)localSettings.Values["LanguagePreference"];
}
Context = ResourceContext.GetForCurrentView();
var lang = new List<string> { selectedLanguage };
Context.Languages = lang;
ResourceStringMap = ResourceManager.Current.MainResourceMap.GetSubtree(@"Util\Resources");
This is how I change the language from dropdown
private async void MenuFlyoutItem_Click(object sender, RoutedEventArgs e)
{
Frame.CacheSize = 0;
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "de-DE";
ApplicationData.Current.LocalSettings.Values["LanguagePreference"] = "de-DE";
await Task.Delay(100);
Frame.Navigate(this.GetType());
}
What am I missing here? any configurations? any files needed with the release?