Now your app will have the ablity to let user switch custom languages!Ĭreative Commons Attribution-ShareAlike 4. To do that, modify App.xaml, and in the OnLaunched event handler, add the following code protected override async void OnLaunched(LaunchActivatedEventArgs e)ĪpplicationLanguages.PrimaryLanguageOverride = Set the ApplicationLanguages.PrimaryLanguageOverride when App starts. How to let the App know what language to apply to the UI? SelectedLanguage = Languages.FirstOrDefault() Var f = Languages.FirstOrDefault(l => l.LanguageCode = selectedLanguage) If (!string.IsNullOrEmpty(selectedLanguage)) To do that, add code in your ViewModel: var selectedLanguage = AppSettings.PrimaryLanguageOverride On the UI, it still need to remember what language did the user previously selected, and set the selected item on the ComboBox according to that value. SaveSettings(nameof(PrimaryLanguageOverride), value) Īlso, add a UI binding property for that public Language SelectedLanguageĪppSettings.PrimaryLanguageOverride = value.LanguageCode Get => ReadSettings(nameof(PrimaryLanguageOverride), "en-US") ![]() There are 32 different languages for you to choose from. SaveSettings(nameof(UsePrimaryLanguageOverride), value) Īnd we need another key to store what languages did the user select, by default, it is en-US to match the App's default language. You can change the language by going to the Menu on the left and tapping Language. Get => ReadSettings(nameof(UsePrimaryLanguageOverride), false) So, adding a new settings key in AppSettings: public bool UsePrimaryLanguageOverride You can read my previous post for how to do it. In my App's design, settings are managed by an AppSettings class. Customizable Language Switcher 4.99/month or 4.17/month billed at 49.99 once per year Free Plan 150k Characters Of AI Translation / Calendar Month Location Based Translation Translation Of GDPR Consent Bar Import Export 9.99/month or 8.33/month billed at 99. To let user decide if they want override UI language or just follow system settings, we also need to add a new settings key to store the option. Then, adding a new class file for matching the language code and display name in order to show it in settings language dropdown list: public class LanguageĬreate a property for UI binding private ObservableCollection _languages The Hans Hermann Voss Foundation supports phyphox directly since the end of 2019, which most importantly enables us to provide more teacher training and better communication and. Put resw files into "Strings\LanguageCode" folder is a conventsion by UWP Apps, it does not require any code to achieve the ablity to show different UI language according to system language. Through this program, the development of the app has been funded in 2016/2017 as well as a Bluetooth interface in 2017/2018 and distributed experiments in 2018/2019. The user can override the system language in App's settings page:įirst, you need to have resource files as usual for multi-language Apps like this: In my App, I supports Simplified Chinese and English. However, what if the user need the ability to set a particular UI language just for your App without having to change system language? Original Edi Wang Saturday, September 9, 2017īy default, a UWP App's UI language is automatically fits the system current language settings.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |