mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 18:56:17 +01:00
rtl layout progress and updates to arabic translations
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import i18n from "i18next"
|
||||
import { initReactI18next } from "react-i18next"
|
||||
import enTranslations from "../locales/en/translation.json"
|
||||
import { $direction } from "./stores"
|
||||
|
||||
// Custom language detector to use localStorage
|
||||
const languageDetector: any = {
|
||||
@@ -62,6 +63,9 @@ export async function setLang(locale: string) {
|
||||
const messages = await loadMessages(locale)
|
||||
i18n.addResourceBundle(locale, "translation", messages)
|
||||
await i18n.changeLanguage(locale)
|
||||
const dir = i18n.dir(locale)
|
||||
document.dir = dir
|
||||
$direction.set(dir)
|
||||
}
|
||||
|
||||
// Initialize with detected/saved language
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
[
|
||||
{
|
||||
"lang": "ar",
|
||||
"label": "العربية"
|
||||
},
|
||||
{
|
||||
"lang": "de",
|
||||
"label": "Deutsch"
|
||||
|
||||
@@ -39,3 +39,6 @@ export const $containerFilter = atom("")
|
||||
|
||||
/** Fallback copy to clipboard dialog content */
|
||||
export const $copyContent = atom("")
|
||||
|
||||
/** Direction for localization */
|
||||
export const $direction = atom<"ltr" | "rtl">("ltr")
|
||||
|
||||
Reference in New Issue
Block a user