diff --git a/docs/TRANSLATIONS.md b/docs/TRANSLATIONS.md index 5305953b..493c81a2 100644 --- a/docs/TRANSLATIONS.md +++ b/docs/TRANSLATIONS.md @@ -26,8 +26,8 @@ To get started with translations: } } ``` -3. **Set the correct language direction:** Make sure to set `lang_direction` to either RTL (Right-to-left) or LTR (Left-to-right) -4. Replace `"language-code"` with your language code (e.g. `"es"` for Spanish). + +3. Replace `"language-code"` with your language code (e.g. `"es"` for Spanish). ## Available Languages @@ -55,7 +55,6 @@ ModernZ currently has translations for the following languages: ```json { "en": { - "lang_direction": "LTR", "idle": "Drop files or URLs here to play", "na": "Not available", "video": "Video", @@ -115,7 +114,6 @@ ModernZ currently has translations for the following languages: | Key | Description | Format Notes | | ---------------------------------------------- | ------------------------------ | ---------------- | -| `lang_direction` | language direction. RTL or LTR | direction preset | | `idle` | Idle message | State label | | `na` | Not available | Text label | | `video` | Video | Text label | diff --git a/extras/locale/modernz-locale.json b/extras/locale/modernz-locale.json index 4ff4ccff..5c103e40 100644 --- a/extras/locale/modernz-locale.json +++ b/extras/locale/modernz-locale.json @@ -1,6 +1,5 @@ { "fr": { - "lang_direction": "LTR", "idle": "Déposez des fichiers ou des URL ici pour lire", "na": "Non disponible", "video": "Vidéo", @@ -34,7 +33,6 @@ "menu": "Menu" }, "de": { - "lang_direction": "LTR", "idle": "Dateien oder URLs hier ablegen, um sie abzuspielen", "na": "Nicht verfügbar", "video": "Video", @@ -68,7 +66,6 @@ "menu": "Menü" }, "es": { - "lang_direction": "LTR", "idle": "Suelta archivos o URL aquí para reproducir", "na": "No disponible", "video": "Vídeo", @@ -102,7 +99,6 @@ "menu": "Menú" }, "pl": { - "lang_direction": "LTR", "idle": "Upuść pliki lub adresy URL tutaj, aby odtworzyć", "na": "Niedostępne", "video": "Wideo", @@ -136,7 +132,6 @@ "menu": "Menu" }, "jp": { - "lang_direction": "LTR", "idle": "ここにファイルやURLをドロップして再生", "na": "利用不可", "video": "ビデオ", @@ -170,7 +165,6 @@ "menu": "メニュー" }, "zh": { - "lang_direction": "LTR", "idle": "将文件或 URL 拖放到此处播放", "na": "不可用", "video": "视频", @@ -204,7 +198,6 @@ "menu": "菜单" }, "ar": { - "lang_direction": "RTL", "idle": "اسحب الملفات أو الروابط هنا للتشغيل", "na": "غير متاح", "video": "فيديو", @@ -238,7 +231,6 @@ "menu": "القائمة" }, "ru": { - "lang_direction": "LTR", "idle": "Перетащите файлы или URL сюда для воспроизведения", "na": "Недоступно", "video": "Видео", @@ -272,7 +264,6 @@ "menu": "Меню" }, "is": { - "lang_direction": "LTR", "idle": "Dragðu skrár eða vefslóðir hingað til að spila", "na": "Ekki tiltækt", "video": "Myndband", @@ -306,7 +297,6 @@ "menu": "Valmynd" }, "dk": { - "lang_direction": "LTR", "idle": "Træk filer eller URL'er hertil for at afspille", "na": "Ikke tilgængelig", "video": "Video", diff --git a/modernz.lua b/modernz.lua index ef895d22..267b2b7c 100644 --- a/modernz.lua +++ b/modernz.lua @@ -1,4 +1,4 @@ --- ModernZ v0.3.1 (https://github.com/Samillion/ModernZ) +-- ModernZ v0.3.2rc (https://github.com/Samillion/ModernZ) -- -- This script is a derivative of the original mpv-osc-modern by maoiscat -- and subsequent forks: @@ -408,6 +408,11 @@ local language = { }, } +local bidi = { + fsi = "\226\129\168", -- U+2068 first strong isolate + pdi = "\226\129\169", -- U+2069 pop directional isolate +} + -- locale JSON file handler local function get_locale_from_json(path) local expand_path = mp.command_native({'expand-path', path}) @@ -453,12 +458,8 @@ if external then end local locale -local rtl = false -- locale language direction (true if RTL) -local rtl_reset = "{\\rDefault}" -- cached ASS reset tag, includes \\fe-1 for RTL local function set_osc_locale() locale = language[user_opts.language] or language["en"] - rtl = (locale.lang_direction or "ltr"):lower() == "rtl" - rtl_reset = rtl and "{\\rDefault\\fe-1}" or "{\\rDefault}" end local function contains(list, item) @@ -1646,11 +1647,11 @@ local function render_elements(master_ass, osc_vis, wc_vis) end elem_ass:new_event() - elem_ass:append(rtl_reset) + elem_ass:append("{\\rDefault}") elem_ass:pos(tx, ty) elem_ass:an(an) elem_ass:append(element.tooltip_style) - elem_ass:append(tooltiplabel) + elem_ass:append(bidi.fsi .. tooltiplabel .. bidi.pdi) end end end