You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
697 B
31 lines
697 B
using System.Globalization;
|
|
using ex_Localization.Resources.Localization;
|
|
|
|
namespace ex_Localization;
|
|
|
|
public partial class MainPage : ContentPage
|
|
{
|
|
public MainPage()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
void picker_SelectedIndexChanged(object source, EventArgs args)
|
|
{
|
|
string? chosenCultureString = picker.SelectedItem as string;
|
|
|
|
CultureInfo chosenCulture = chosenCultureString switch
|
|
{
|
|
"fr-FR" => new CultureInfo("fr-FR"),
|
|
"en" => new CultureInfo("en"),
|
|
"ca-ES" => new CultureInfo("ca-ES"),
|
|
"es-ES" => new CultureInfo("es-ES"),
|
|
"it" => new CultureInfo("it"),
|
|
_ => new CultureInfo("en")
|
|
};
|
|
|
|
AppResources.Culture = chosenCulture;
|
|
}
|
|
}
|
|
|