Senhores,
Estou fazendo alguns testes com locale, mas estou com o seguinte problema: Quando o formato do micro está como Pt(BR), o programa não muda o idioma ao clicar no botão. Quando eu troco para qualquer outro formato, o sistema funciona perfeitamente, ou seja, se eu escolher Pt os labels mudam conforme MessagesBundle_pt_BR.properties e se eu escolher En, os labels mudam para MessagesBundle.properties.
Criei um form com um botão, alguns labels e um combo para a escolha do idioma (Pt ou En).
Segue os códigos:
[code] private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String idioma;
String language;
String country;
idioma = (String) jComboBox1.getSelectedItem();
JLabel[] jLabels = new JLabel[3];
jLabels[0] = jLabel1;
jLabels[1] = jLabel2;
jLabels[2] = jLabel3;
Locale currentLocale;
if (idioma.equals("Pt"))
{
language = new String("pt");
country = new String("BR");
}
else
{
language = new String("en");
country = new String("US");
}
currentLocale = new Locale(language, country);
ResourceBundle labels =
ResourceBundle.getBundle("MessagesBundle", currentLocale);
for (int j=0;j<jLabels.length;j++)
{
jLabels[j].setText(labels.getString("jLabe1" + String.valueOf( j+1 ) ));
}
}[/code]
Arquivo: MessagesBundle_pt_BR.properties
jLabe11 = Curva de Saturação.
jLabe12 = Características de Partida.
jLabe13 = Curva V
Arquivo: MessagesBundle.properties
jLabe11 = Saturation Curve.
jLabe12 = Starting Characteristics.
jLabe13 = VEE Curves
Alguém sabe o que pode estar acontecendo?