commit 9a472bf0b4f6b5d7b99ecd7c5a285cc88be13d62
parent e40dd10bca0f6c5ee39eb0413df71bd24ed22dc5
Author: triesap <triesap@radroots.dev>
Date: Mon, 3 Nov 2025 21:39:52 +0000
Add i18n utility for locale handling and async translation loading. Integrate custom fonts and theme variables into app styles and HTML. Add phosphor-icons submodule and extend ignore rules for static assets.
Diffstat:
6 files changed, 63 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -39,4 +39,7 @@ justfile
*dev*.toml
*dev*.json
dev/data/
-dev/logs/
-\ No newline at end of file
+dev/logs/
+
+# static
+app/static/fonts
+\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
@@ -2,3 +2,6 @@
path = app/static/assets
url = git@github.com:radrootslabs/assets.git
branch = app
+[submodule "app/static/phosphor-icons"]
+ path = app/static/phosphor-icons
+ url = git@github.com:radrootslabs/phosphor-icons.git
diff --git a/app/src/app.css b/app/src/app.css
@@ -2,9 +2,23 @@
@import "../theme.css";
+@import "../static/fonts/brown-regular/styles.css";
+@import "../static/fonts/serif/styles.css";
+
@plugin "daisyui" {
themes: os_light, os_dark;
}
+@source "./lib/**/*.{svelte,ts}";
@source "../../../packages/apps-lib/src/**/*.{svelte,ts}";
@source "../../../packages/apps-lib-market/src/**/*.{svelte,ts}";
+
+@theme {
+ --font-br: "Brown";
+ --font-rsf: "RadrootsSerif";
+ --font-rsfd: "RadrootsSerifDisplay";
+
+ --color-morning_snow: #f8f4ee;
+ --color-cloak_grey: #616161;
+ --color-black_panther: #424242;
+}
+\ No newline at end of file
diff --git a/app/src/app.html b/app/src/app.html
@@ -3,10 +3,15 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="/assets/keyva.min.js"></script>
+ <link rel="stylesheet" type="text/css" href="/phosphor-icons/regular.css" />
+ <link rel="stylesheet" type="text/css" href="/phosphor-icons/bold.css" />
+ <link rel="stylesheet" type="text/css" href="/phosphor-icons/fill.css" />
+ <link rel="stylesheet" type="text/css" href="/phosphor-icons/light.css" />
+
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no viewport-fit=cover" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
diff --git a/app/src/lib/utils/i18n.ts b/app/src/lib/utils/i18n.ts
@@ -0,0 +1,33 @@
+import { i18n_conf } from '@radroots/apps-lib';
+import { iso639_1, locales_default, type Locales } from '@radroots/locales';
+
+export type Locale = Locales;
+
+const translations: Record<Locale, typeof iso639_1> = locales_default.reduce((acc, locale) => ({ ...acc, [locale as Locale]: iso639_1, }), {} as Record<Locale, typeof iso639_1>);
+const locale_keys = Object.keys(translations);
+
+const i18n = i18n_conf<Locale>({
+ default_locale: `en`,
+ translations,
+ loaders: [
+ ...locale_keys.map((locale) => [`common`, `countries`, `error`, `eula`, `icu`, `market`, `notification`, `units`].map(key => ({
+ locale,
+ key,
+ loader: async () => (await import(`../../../../../packages/locales/src/messages/${locale}/${key}.json`)).default
+ }))),
+ ].flat()
+});
+
+const {
+ t: ls,
+ loading: translations_loading,
+ locales,
+ locale,
+ loadTranslations: load_translations
+} = i18n;
+
+translations_loading.subscribe(async (_loading) => {
+ if (_loading) await translations_loading.toPromise();
+});
+
+export { load_translations, locale, locales, ls, translations, translations_loading };
diff --git a/app/static/phosphor-icons b/app/static/phosphor-icons
@@ -0,0 +1 @@
+Subproject commit 0a3d9e3b6b0aed4dd7586ebe534d3dc3d93e8a34