web_lib

Common web application libraries
git clone https://radroots.dev/git/web_lib.git
Log | Files | Refs | LICENSE

commit e03c76dabb92f6c6a9099a4a986b08ac6d39f0a2
parent cf436cdd12b4fd643933d1a011e924ad58c085a2
Author: triesap <137732411+triesap@users.noreply.github.com>
Date:   Sat,  7 Dec 2024 19:12:26 +0000

apps-lib: edit localised string translation function export

Diffstat:
Mapps-lib/src/lib/components/button_layout_pair.svelte | 6+++---
Mapps-lib/src/lib/components/button_loading.svelte | 6+++---
Mapps-lib/src/lib/components/envelope_lower.svelte | 4++--
Mapps-lib/src/lib/components/envelope_titled.svelte | 7++++---
Mapps-lib/src/lib/components/trellis.svelte | 4++--
Mapps-lib/src/lib/locales/i18n.ts | 4++--
Mapps-lib/src/lib/utils/client.ts | 6+++---
7 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/apps-lib/src/lib/components/button_layout_pair.svelte b/apps-lib/src/lib/components/button_layout_pair.svelte @@ -2,7 +2,7 @@ import { app_layout, Fill, - t, + ls, type CallbackPromise, type IDisabledOpt, } from "$lib"; @@ -25,7 +25,7 @@ <ButtonLayout basis={{ disabled: basis.continue.disabled, - label: basis.continue.label || `${$t(`common.continue`)}`, + label: basis.continue.label || `${$ls(`common.continue`)}`, callback: basis.continue.callback, }} /> @@ -41,7 +41,7 @@ <p class={`font-sans font-[600] tracking-wide text-layer-1-glyph-shade ${basis.back?.disabled ? `` : `group-active:text-layer-1-glyph/40`} el-re`} > - {basis.back?.label || `${$t(`common.back`)}`} + {basis.back?.label || `${$ls(`common.back`)}`} </p> </button> {:else} diff --git a/apps-lib/src/lib/components/button_loading.svelte b/apps-lib/src/lib/components/button_loading.svelte @@ -1,8 +1,8 @@ <script lang="ts"> - import { type CallbackPromise, fmt_cl, Loading, t } from "$lib"; + import { type CallbackPromise, fmt_cl, Loading, ls } from "$lib"; export let basis: { - classes?:string; + classes?: string; callback: CallbackPromise; loading?: boolean; label?: string; @@ -19,6 +19,6 @@ {#if basis.loading} <Loading basis={{ dim: `xs` }} /> {:else} - {basis.label || `${$t(`common.submit`, { default: `submit` })}`} + {basis.label || `${$ls(`common.submit`, { default: `submit` })}`} {/if} </button> diff --git a/apps-lib/src/lib/components/envelope_lower.svelte b/apps-lib/src/lib/components/envelope_lower.svelte @@ -1,5 +1,5 @@ <script lang="ts"> - import { envelope_visible, Fill, t, type CallbackPromise } from "$lib"; + import { envelope_visible, Fill, ls, type CallbackPromise } from "$lib"; import { quintInOut } from "svelte/easing"; import { fly } from "svelte/transition"; @@ -66,7 +66,7 @@ > {typeof basis.label_close === `string` ? basis.label_close - : `${$t(`common.cancel`)}`} + : `${$ls(`common.cancel`)}`} </p> </button> {:else} diff --git a/apps-lib/src/lib/components/envelope_titled.svelte b/apps-lib/src/lib/components/envelope_titled.svelte @@ -5,7 +5,7 @@ Fill, fmt_cl, type IEnvelopeTitledBasis, - t, + ls, } from "$lib"; import type { ThemeLayer } from "@radroots/theme"; @@ -37,7 +37,7 @@ <p class={`${fmt_cl(basis.previous?.label?.classes)} font-sans text-envelopeTitlePrevious text-layer-${layer}-glyph-hl group-active:opacity-40 el-re`} > - {basis.previous?.label?.value || `${$t(`common.cancel`)}`} + {basis.previous?.label?.value || `${$ls(`common.cancel`)}`} </p> </button> </div> @@ -73,7 +73,8 @@ <p class={`font-sans text-envelopeTitleAction ${classes_submit} el-re`} > - {basis.submit?.label.value || `${$t(`common.add`)}`} + {basis.submit?.label.value || + `${$ls(`common.add`)}`} </p> {:else} <Fill /> diff --git a/apps-lib/src/lib/components/trellis.svelte b/apps-lib/src/lib/components/trellis.svelte @@ -2,8 +2,8 @@ import { app_layout, fmt_cl, + ls, parse_layer, - t, TrellisDefaultLabel, TrellisInput, TrellisOffset, @@ -60,7 +60,7 @@ ? args.default_el.labels : [ { - label: `${$t(`common.no_items_to_display`)}.`, + label: `${$ls(`common.no_items_to_display`)}.`, }, ]} /> diff --git a/apps-lib/src/lib/locales/i18n.ts b/apps-lib/src/lib/locales/i18n.ts @@ -30,7 +30,7 @@ const config: Config<LanguageConfig> = { }; const { - t, + t: ls, loading: translations_loading, locales, locale, @@ -43,5 +43,5 @@ translations_loading.subscribe(async ($loading) => { }); export { - load_translations, locale, locales, t, translations, translations_loading + load_translations, locale, locales, ls, translations, translations_loading }; diff --git a/apps-lib/src/lib/utils/client.ts b/apps-lib/src/lib/utils/client.ts @@ -1,5 +1,5 @@ import { goto } from "$app/navigation"; -import { app_toast, locale, nav_prev, t, TOAST_MS, type AnchorRoute, type AppConfigType, type AppLayoutKey, type CallbackPromise, type CallbackPromiseGeneric, type GeolocationLatitudeFmtOption, type GlyphKey, type IToast, type LabelFieldKind, type LayerGlyphBasisKind, type NavigationParamTuple, type NavigationRoute, type NavigationRouteParamKey } from "$lib"; +import { app_toast, locale, ls, nav_prev, TOAST_MS, type AnchorRoute, type AppConfigType, type AppLayoutKey, type CallbackPromise, type CallbackPromiseGeneric, type GeolocationLatitudeFmtOption, type GlyphKey, type IToast, type LabelFieldKind, type LayerGlyphBasisKind, type NavigationParamTuple, type NavigationRoute, type NavigationRouteParamKey } from "$lib"; import type { ColorMode, ThemeKey, ThemeLayer } from "@radroots/theme"; import { get } from "svelte/store"; @@ -287,7 +287,7 @@ export const exe_iter = async (callback: CallbackPromise, num: number = 1, delay }; export const fmt_list_oxford = (list: string[], loc_key?: string): string => { - if (list.length > 1 && loc_key) return `${list.slice(0, -1).map(i => `${loc_key}${i}`).join(', ')} ${`${get_store(t)(`common.and`)}`} ${`${loc_key}${list[list.length - 1]}`}`; - else if (list.length > 1) return `${list.slice(0, -1).join(', ')} ${`${get_store(t)(`common.and`)}`} ${list[list.length - 1]}`; + if (list.length > 1 && loc_key) return `${list.slice(0, -1).map(i => `${loc_key}${i}`).join(', ')} ${`${get_store(ls)(`common.and`)}`} ${`${loc_key}${list[list.length - 1]}`}`; + else if (list.length > 1) return `${list.slice(0, -1).join(', ')} ${`${get_store(ls)(`common.and`)}`} ${list[list.length - 1]}`; return list[0]; }; \ No newline at end of file