Jump to content
Sign in to follow this  
rosacastro

Mudar a culture

Recommended Posts

rosacastro

Olá,

tenho uma label onde quero mostrar a data com o seguinte formato: "Ter 15 Mar 2011".

Já mudei a culture no arranque aplicação (antes de InitializeComponent(); ):

Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-PT");

Thread.CurrentThread.CurrentUICulture = new CultureInfo("pt-PT");

mas mesmo assim continua a mostrar a data em inglês.

Se alguém me puder ajudar agradeço.

Share this post


Link to post
Share on other sites
f-22

Tenta isto.

CultureInfo cultureInfo = new CultureInfo("pt-PT");
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;

Estás em windows forms ou web?

Se tiveres em web podes fazer:

<globalization uiCulture="pt-PT" culture="pt-PT" />

Share this post


Link to post
Share on other sites
marciocardoso

using System.Globalization;

using System.Threading;

crias esta função:

  private void ChangeLanguage(string lang)

        {

            foreach (Control c in this.Controls)

            {

                ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));

                resources.ApplyResources(c, c.Name, new CultureInfo(lang));

            }

        }

depois é so chamar :

ChangeLanguage("pt_PT");

Diz se funcionou.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.