Created
February 18, 2022 14:43
-
-
Save TBertuzzi/87a916a72de548110074995e5c36dd3d to your computer and use it in GitHub Desktop.
MultiLingua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Globalization; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Xamarin.Forms; | |
using XamarinFormsMultiLinguagem.Resources; | |
namespace XamarinFormsMultiLinguagem | |
{ | |
public partial class MainPage : ContentPage | |
{ | |
public MainPage() | |
{ | |
InitializeComponent(); | |
} | |
void AlterarLinguagem(string linguagem) | |
{ | |
var language = new CultureInfo(linguagem); | |
Thread.CurrentThread.CurrentUICulture = language; | |
AppResources.Culture = language; | |
} | |
public async void btnInglesClickedAsync(object sender, System.EventArgs e) | |
{ | |
AlterarLinguagem("en-US"); | |
await Navigation.PushAsync(new BemVindoPage()); | |
} | |
public async void btnPortuguesClickedAsync(object sender, System.EventArgs e) | |
{ | |
AlterarLinguagem("pt-BR"); | |
await Navigation.PushAsync(new BemVindoPage()); | |
} | |
public async void btnJaponesClickedAsync(object sender, System.EventArgs e) | |
{ | |
AlterarLinguagem("ja-JP"); | |
await Navigation.PushAsync(new BemVindoPage()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment