Estoy trabajando en Sencha
EXTJS 6
, y tengo un calendario de fechas llamado Datefield
el cual al desplegarse funciona correctamente pero esta en ingles y quisiera traducirlo al español, pero tanto en el Sencha Architech
como en el codigo no encuentro referencia a las palabras a excepcion del archivo que se ubica en ext/classic/overrides/es/ext-locale-es.js
, el cual contiene todas las traducciones de las fechas, meses, dias etc y los metodos.
No se si realmente este archivo tiene que ver con el datefield
, o si bien hay que reemplazarlo, importarlo etc.
El datefield es este en el archivo de la vista:
xtype: 'datefield',
x: 0,
y: 50,
width: 320,
fieldLabel: 'Fecha Inicio',
name: 'date_fechaInicio',
formatText: 'El formato de la fecha debe ser: {0}',
invalidText: '{0} No es una fecha valida - Debe tener el siguiente formato {1}',
format: 'd/m/Y',
maxText: 'La fecha en este campo debe ser igual o menor a {0}',
minText: 'La fecha en este campo debe ser igual o superior a {0}',
submitFormat: 'd/m/Y',
listeners: {
change: 'onFechaInicioChange',
afterrender: 'onDatefieldAfterRender'
Dentro de los metodos que afectan a los datefield, que tengo 2 ( fecha inicio y fecha fin) son estos:
renderHora: function(value) {
var value = new Date(value),
hora = value.getHours(),
minuto = (value.getMinutes() === 0)?'00':value.getMinutes();
console.log('primer valor: '+ value);
// if(typeof(value) == "string"){
// console.log('string');
// }else{
// console.log('date');
// }
// var lo = '8:30';
// if(typeof(lo) == "string"){
// console.log('string');
// }else{
// console.log('date');
// }
//console.log("tipo dato: "+typeof(value));
// var minuto = minuto / 60;
// var sumando = hora + minuto;
// console.log('suma: '+sumando);
//var hora2 = Ext.ComponentQuery.query('[itemId=grid_jornadaLaboral]')[0].getStore().data.items[1].data.entrada_manana;
hora = hora.toString();
if(hora.length < 2)
{
hora = '0'+hora;
}
minuto = minuto.toString();
if(minuto.length < 2)
{
minuto = '0'+minuto;
}
// console.log(hora +':'+minuto);
return(hora +':'+minuto);
},
onFechaInicioChange: function(field, newValue, oldValue, eOpts) {
var fecha_inicio = field.getValue();
Ext.ComponentQuery.query('datefield[name=date_fechaFin]')[0].setMinValue(fecha_inicio);
},
onDatefieldAfterRender: function(component, eOpts) {
Ext.Ajax.request({
url: 'json/vigencia.php',
params:
{
combo:'fecha_actual'
},
success: function(response, opts)
{
var obj = Ext.decode(response.responseText);
var fecha_actual = obj.root[0].fecha_actual;
inicio_mes = new Date(fecha_actual);
inicio_mes.setDate(1);
fin_mes = new Date(fecha_actual);
fin_mes.setMonth(fin_mes.getMonth()+1);
fin_mes.setDate(30);
component.setMinValue(inicio_mes);
component.setMaxValue(fin_mes);
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});
},
onFechaFinChange: function(field, newValue, oldValue, eOpts) {
var fecha_fin = field.getValue();
Ext.ComponentQuery.query('datefield[name=date_fechaInicio]')[0].setMaxValue(fecha_fin);
Esta incompleto el codigo, por que lo que sigue debajo es de otras secciones:
Mientras tanto el archivo de traduccion q se encuentra en las carpetas por defecto del proyecto dicen algo asi:
Ext.onReady(function() {
if (Ext.Date) {
Ext.Date.monthNames = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];
Ext.Date.getShortMonthName = function(month) {
return Ext.Date.monthNames[month].substring(0, 3);
};
Ext.Date.monthNumbers = {
Ene: 0,
Feb: 1,
Mar: 2,
Abr: 3,
May: 4,
Jun: 5,
Jul: 6,
Ago: 7,
Sep: 8,
Oct: 9,
Nov: 10,
Dic: 11
};
Ext.Date.getMonthNumber = function(name) {
return Ext.Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
};
Ext.Date.dayNames = ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"];
Ext.Date.getShortDayName = function(day) {
if (day == 3) return "Mié";
if (day == 6) return "Sáb";
return Ext.Date.dayNames[day].substring(0, 3);
};
Ext.Date.formatCodes.a = "(this.getHours() < 12 ? 'a.m.' : 'p.m.')";
Ext.Date.formatCodes.A = "(this.getHours() < 12 ? 'A.M.' : 'P.M.')";
// This will match am or a.m.
Ext.Date.parseCodes.a = Ext.Date.parseCodes.A = {
g:1,
c:"if (/(a\\.?m\\.?)/i.test(results[{0}])) {\n"
+ "if (!h || h == 12) { h = 0; }\n"
+ "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
s:"(A\\.?M\\.?|P\\.?M\\.?|a\\.?m\\.?|p\\.?m\\.?)",
calcAtEnd: true
};
Ext.Date.parseCodes.S.s = "(?:st|nd|rd|th)";
}
if (Ext.util && Ext.util.Format) {
Ext.apply(Ext.util.Format, {
thousandSeparator: '.',
decimalSeparator: ',',
currencySign: '\u20ac',
// Spanish Euro
dateFormat: 'd/m/Y'
});
}
});
Entonces, quisiera saber si existe una relacion entre ese archivo de configuracion respecto a los campos del datefield
, o si hay que importarlo, o modificarlo a mano en otro lado.
Segun veo, cada vez que posiciono el mouse sobre alguna opcion del datafield me apareceuna burbuja de sugerencia, y esos textos estan en el archvi èxt-locale-en.js`, pero si los modifico, tanto el de la carpeta de ingles /en o britanico /en.gb, no sucede nada.
Alguno tiene idea como traducirlo?
Espero puedan ayudarme Saludos y gracias!!