Change translate function
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 4s

This commit is contained in:
2026-04-30 22:13:26 +02:00
parent 2a14fad95b
commit 60483765c9
8 changed files with 19 additions and 77 deletions

View File

@@ -10,28 +10,18 @@ const rand = (r) => `${r}-${Math.random().toString(36).slice(2, 9)}`
export const hide = () => document.activeElement?.blur()
// Locales
export const i18n = {
export const lang = {
es: {
close: "Cerrar",
confirm: "Confirmar",
cancel: "Cancelar",
search: "Buscar...",
loading: "Cargando...",
nodata: "Sin datos"
uploadFiles: "Arrastrar y soltar o click para seleccionar...",
},
en: {
close: "Close",
confirm: "Confirm",
cancel: "Cancel",
search: "Search...",
loading: "Loading...",
nodata: "No data"
uploadFiles: "Drag and drop or click to select",
}
};
export const currentLocale = $("en");
export const Locale = t => currentLocale(t);
export const tt = t => () => i18n[currentLocale()][t] || t;
export const t = t => () => lang[currentLocale()][t] || t;
// Components
export const Accordion = (p) => {
@@ -344,7 +334,7 @@ export const Fileinput = (p) => {
}, [
h('div', { class: 'flex items-center gap-3 w-full' }, [
h('span', { class: 'icon-[lucide--upload]' }),
h('span', { class: 'text-sm opacity-70 truncate grow text-left' }, 'Drag and drop...'),
h('span', { class: 'text-sm opacity-70 truncate grow text-left' }, t("uploadFiles")),
h('span', { class: 'text-[10px] opacity-40 shrink-0' }, `Máx ${p.max || 2}MB`)
]),
h('input', {
@@ -608,34 +598,6 @@ export const Toast = (message, type = "alert-success", duration = 3500) => {
export const Toggle = (p) => h("input", { ...p, type: "checkbox", class: cls("toggle", p.class) });
export const Tooltip = (p, c) => h("div", { ...p, class: cls("tooltip", p.class), "data-tip": p.tip }, c);
// Editor
export const Editor = (p) => {
const { value, class: extraClass } = p