Change translate function
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 4s
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 4s
This commit is contained in:
16
dist/sigpro-ui.esm.js
vendored
16
dist/sigpro-ui.esm.js
vendored
@@ -506,20 +506,10 @@ var rand = (r) => `${r}-${Math.random().toString(36).slice(2, 9)}`;
|
|||||||
var hide = () => document.activeElement?.blur();
|
var hide = () => document.activeElement?.blur();
|
||||||
var i18n = {
|
var i18n = {
|
||||||
es: {
|
es: {
|
||||||
close: "Cerrar",
|
uploadFiles: "Arrastrar y soltar o click para seleccionar..."
|
||||||
confirm: "Confirmar",
|
|
||||||
cancel: "Cancelar",
|
|
||||||
search: "Buscar...",
|
|
||||||
loading: "Cargando...",
|
|
||||||
nodata: "Sin datos"
|
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
close: "Close",
|
uploadFiles: "DRag and drop or click to select"
|
||||||
confirm: "Confirm",
|
|
||||||
cancel: "Cancel",
|
|
||||||
search: "Search...",
|
|
||||||
loading: "Loading...",
|
|
||||||
nodata: "No data"
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var currentLocale = P("en");
|
var currentLocale = P("en");
|
||||||
@@ -901,7 +891,7 @@ var Fileinput = (p) => {
|
|||||||
}, [
|
}, [
|
||||||
A("div", { class: "flex items-center gap-3 w-full" }, [
|
A("div", { class: "flex items-center gap-3 w-full" }, [
|
||||||
A("span", { class: "icon-[lucide--upload]" }),
|
A("span", { class: "icon-[lucide--upload]" }),
|
||||||
A("span", { class: "text-sm opacity-70 truncate grow text-left" }, "Drag and drop..."),
|
A("span", { class: "text-sm opacity-70 truncate grow text-left" }, tt("uploadFiles")),
|
||||||
A("span", { class: "text-[10px] opacity-40 shrink-0" }, `Máx ${p.max || 2}MB`)
|
A("span", { class: "text-[10px] opacity-40 shrink-0" }, `Máx ${p.max || 2}MB`)
|
||||||
]),
|
]),
|
||||||
A("input", {
|
A("input", {
|
||||||
|
|||||||
2
dist/sigpro-ui.esm.min.js
vendored
2
dist/sigpro-ui.esm.min.js
vendored
File diff suppressed because one or more lines are too long
16
dist/sigpro-ui.js
vendored
16
dist/sigpro-ui.js
vendored
@@ -536,20 +536,10 @@
|
|||||||
var hide = () => document.activeElement?.blur();
|
var hide = () => document.activeElement?.blur();
|
||||||
var i18n = {
|
var i18n = {
|
||||||
es: {
|
es: {
|
||||||
close: "Cerrar",
|
uploadFiles: "Arrastrar y soltar o click para seleccionar..."
|
||||||
confirm: "Confirmar",
|
|
||||||
cancel: "Cancelar",
|
|
||||||
search: "Buscar...",
|
|
||||||
loading: "Cargando...",
|
|
||||||
nodata: "Sin datos"
|
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
close: "Close",
|
uploadFiles: "DRag and drop or click to select"
|
||||||
confirm: "Confirm",
|
|
||||||
cancel: "Cancel",
|
|
||||||
search: "Search...",
|
|
||||||
loading: "Loading...",
|
|
||||||
nodata: "No data"
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var currentLocale = P("en");
|
var currentLocale = P("en");
|
||||||
@@ -931,7 +921,7 @@
|
|||||||
}, [
|
}, [
|
||||||
A("div", { class: "flex items-center gap-3 w-full" }, [
|
A("div", { class: "flex items-center gap-3 w-full" }, [
|
||||||
A("span", { class: "icon-[lucide--upload]" }),
|
A("span", { class: "icon-[lucide--upload]" }),
|
||||||
A("span", { class: "text-sm opacity-70 truncate grow text-left" }, "Drag and drop..."),
|
A("span", { class: "text-sm opacity-70 truncate grow text-left" }, tt("uploadFiles")),
|
||||||
A("span", { class: "text-[10px] opacity-40 shrink-0" }, `Máx ${p.max || 2}MB`)
|
A("span", { class: "text-[10px] opacity-40 shrink-0" }, `Máx ${p.max || 2}MB`)
|
||||||
]),
|
]),
|
||||||
A("input", {
|
A("input", {
|
||||||
|
|||||||
4
dist/sigpro-ui.min.js
vendored
4
dist/sigpro-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -789,6 +789,6 @@ Displays an 8×8 grid of preset colours.
|
|||||||
|
|
||||||
## Utility Functions
|
## Utility Functions
|
||||||
|
|
||||||
- **`Locale(lang)`** – Signal to read/set the current language (`"es"` or `"en"`).
|
- **`Locale(lang)`** – Signal to read/set the current language (`"en"` or `"es"`).
|
||||||
- **`tt(key)`** – Returns a reactive translation string from the built‑in dictionary based on current locale.
|
- **`t(key)`** – Returns a reactive translation string from the built‑in dictionary based on current locale.
|
||||||
```
|
```
|
||||||
4
docs/sigpro-ui.min.js
vendored
4
docs/sigpro-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sigpro-ui",
|
"name": "sigpro-ui",
|
||||||
"version": "1.2.6",
|
"version": "1.2.8",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
48
sigpro-ui.js
48
sigpro-ui.js
@@ -10,28 +10,18 @@ const rand = (r) => `${r}-${Math.random().toString(36).slice(2, 9)}`
|
|||||||
export const hide = () => document.activeElement?.blur()
|
export const hide = () => document.activeElement?.blur()
|
||||||
|
|
||||||
// Locales
|
// Locales
|
||||||
export const i18n = {
|
export const lang = {
|
||||||
es: {
|
es: {
|
||||||
close: "Cerrar",
|
uploadFiles: "Arrastrar y soltar o click para seleccionar...",
|
||||||
confirm: "Confirmar",
|
|
||||||
cancel: "Cancelar",
|
|
||||||
search: "Buscar...",
|
|
||||||
loading: "Cargando...",
|
|
||||||
nodata: "Sin datos"
|
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
close: "Close",
|
uploadFiles: "Drag and drop or click to select",
|
||||||
confirm: "Confirm",
|
|
||||||
cancel: "Cancel",
|
|
||||||
search: "Search...",
|
|
||||||
loading: "Loading...",
|
|
||||||
nodata: "No data"
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const currentLocale = $("en");
|
export const currentLocale = $("en");
|
||||||
export const Locale = t => currentLocale(t);
|
export const Locale = t => currentLocale(t);
|
||||||
export const tt = t => () => i18n[currentLocale()][t] || t;
|
export const t = t => () => lang[currentLocale()][t] || t;
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
export const Accordion = (p) => {
|
export const Accordion = (p) => {
|
||||||
@@ -344,7 +334,7 @@ export const Fileinput = (p) => {
|
|||||||
}, [
|
}, [
|
||||||
h('div', { class: 'flex items-center gap-3 w-full' }, [
|
h('div', { class: 'flex items-center gap-3 w-full' }, [
|
||||||
h('span', { class: 'icon-[lucide--upload]' }),
|
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('span', { class: 'text-[10px] opacity-40 shrink-0' }, `Máx ${p.max || 2}MB`)
|
||||||
]),
|
]),
|
||||||
h('input', {
|
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 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);
|
export const Tooltip = (p, c) => h("div", { ...p, class: cls("tooltip", p.class), "data-tip": p.tip }, c);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Editor
|
// Editor
|
||||||
export const Editor = (p) => {
|
export const Editor = (p) => {
|
||||||
const { value, class: extraClass } = p
|
const { value, class: extraClass } = p
|
||||||
|
|||||||
Reference in New Issue
Block a user