Android - Cambio de Locale

 
Vista:
sin imagen de perfil

Cambio de Locale

Publicado por m (3 intervenciones) el 25/07/2017 08:31:35
Tengo dos archivos de Strings en mi proyecto, y para usar uno u otro, trato de cambiar el Locale:

1
2
3
Locale aLocale = new Locale.Builder().setLanguage("es").setRegion("ES").build();
Locale.setDefault(aLocale);
getResources().getConfiguration().setLocale(aLocale);

A juzgar por lo mostrado por esto:

1
2
3
4
5
Locale current = getResources().getConfiguration().locale;
 
Toast.makeText(getApplicationContext(), Locale.getDefault().getCountry()+Locale.getDefault().getLanguage(), Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(), Locale.getDefault().getDisplayLanguage(), Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(),current.toString(), Toast.LENGTH_LONG).show();

parece que se cambia correctamente. No obstante, ello no causa que cambie el texto mostrado. ¿Cómo he de hacerlo?
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder