añadido coger el idioma

This commit is contained in:
2024-09-30 11:06:00 +02:00
parent f09d5aeceb
commit 13e3a69cd6
7 changed files with 43 additions and 3 deletions

View File

@ -5,7 +5,7 @@ class DatosGenerales {
constructor(domItem) {
this.domItem = domItem;
this.formatoLibro = new ClassSelect($("#papelFormatoId"), '/papel-formato/menuitems', 'Seleccione formato');
this.formatoLibro = new ClassSelect($("#papelFormatoId"), '/papel-formato/menuitems', window.translations["formatoLibro"]);
this.checkFormatoPersonalizado = this.domItem.find("#papelFormatoPersonalizado");
this.formatoPersonalizado = this.domItem.find("#formatoPersonalizado");

View File

@ -1,9 +1,26 @@
import DatosGenerales from './datosGenerales.js';
import Ajax from '../../components/ajax.js';
document.addEventListener('DOMContentLoaded', function() {
function initPresupuesto(response){
window.translations = JSON.parse(response);
let datosGenerales = new DatosGenerales($("#datos-generales"));
datosGenerales.init();
}
document.addEventListener('DOMContentLoaded', function() {
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
new Ajax('/translate/getTranslation', {locale: locale, translationFile: 'Presupuestos'}, {},
initPresupuesto,
function(error){
console.log("Error getting translations:", error);
}
).post();
});