diff --git a/package-lock.json b/package-lock.json
index bdb8d51..3a669c9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "anvil",
- "version": "0.0.3",
+ "version": "0.0.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "anvil",
- "version": "0.0.3",
+ "version": "0.0.4",
"devDependencies": {
"@playwright/test": "1.41.2",
"@skeletonlabs/skeleton": "2.8.0",
diff --git a/package.json b/package.json
index 9304f72..fc165c4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "anvil",
- "version": "0.0.3",
+ "version": "0.0.4",
"private": true,
"scripts": {
"dev": "vite dev",
diff --git a/src/lib/i18n/index.ts b/src/lib/i18n/index.ts
index 28759b6..53bbf5a 100644
--- a/src/lib/i18n/index.ts
+++ b/src/lib/i18n/index.ts
@@ -3,10 +3,19 @@ import { init, register } from 'svelte-i18n';
const defaultLocale = 'en';
-register('en', () => import('./locales/en.json'));
register('de', () => import('./locales/de.json'));
+register('en', () => import('./locales/en.json'));
+register('he', () => import('./locales/he.json'));
init({
fallbackLocale: defaultLocale,
initialLocale: browser ? window.navigator.language : defaultLocale
});
+
+export function mapLocaleToDir(locale: 'de' | 'en' | 'he'): 'ltr' | 'rtl' {
+ if (['he'].includes(locale)) {
+ return 'rtl';
+ }
+
+ return 'ltr';
+}
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index faf2157..686dc69 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -7,6 +7,15 @@
// Most of your app wide CSS should be put in this file
import '../app.postcss';
import { AppShell, AppBar } from '@skeletonlabs/skeleton';
+ import { locale, locales } from 'svelte-i18n';
+
+ import { mapLocaleToDir } from '$lib/i18n';
+
+ locale.subscribe((l) => {
+ if (typeof document !== 'undefined') {
+ document.dir = mapLocaleToDir(l);
+ }
+ });
@@ -18,6 +27,11 @@
Anvil
+