DatePicker in Spanish

2

Do you know if you can put DatePicker in Spanish? It's a pijotada but it's in English format and I'd like to have it in Spanish.

    
asked by Red 11.05.2016 в 14:30
source

2 answers

3

In principle the DataPicker takes the language of the system, if you want to force the change although it is not usually a good idea what you have to do is force a change of Locale. but I repeat, it is not recommended.

Here ( link ) you can see how to force the change of Locale:

Resources res = context.getResources();
// Change locale settings in the app.
DisplayMetrics dm = res.getDisplayMetrics();
android.content.res.Configuration conf = res.getConfiguration();
conf.locale = new Locale(language_code.toLowerCase());
res.updateConfiguration(conf, dm);

I hope you find it useful.

    
answered by 11.05.2016 / 14:48
source
-1
$("#inputId").datepicker({

    currentText: 'Hoy',
    monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio',
    'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
    monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun',
    'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
    dayNames: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
    dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mié;', 'Juv', 'Vie', 'Sáb'],
    dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sá'],
    weekHeader: 'Sm'

}).datepicker('show');
    
answered by 11.05.2016 в 15:05