From 9f69cc052e316bdc2d524accd8f802a2b262b684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horv=C3=A1th=20Gell=C3=A9rt?= Date: Sat, 29 Apr 2023 12:52:44 +0200 Subject: [PATCH 1/2] :adhesive_bandage: fix translation :recycle: rename Lang to Locale --- shared/config.lua | 2 +- web/src/App.jsx | 2 +- web/src/Utils/Translate.js | 6 +++--- web/src/assets/translate.json | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/shared/config.lua b/shared/config.lua index 0f15216..c602b9e 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -1,5 +1,5 @@ Config = { - Lang = GetConvar('esx:locale', 'en'):upper(), -- If you want to change UI language texts you can do it here: web/src/assets/translate.json !!IMPORTANT that this can only be modified with the unbuilt version. + Locale = GetConvar('esx:locale', 'en'), -- If you want to change UI language texts you can do it here: web/src/assets/translate.json !!IMPORTANT that this can only be modified with the unbuilt version. Colors = { Info = { ['money-text-color'] = "#4d6973", diff --git a/web/src/App.jsx b/web/src/App.jsx index a5107f2..c27a430 100644 --- a/web/src/App.jsx +++ b/web/src/App.jsx @@ -43,7 +43,7 @@ function App() { value ? open() : close() break; case "SET_CONFIG_DATA": - setLang(value["Lang"]) + setLang(value["Locale"]) setUpdateLang(true) setDefaultConfigs(value) const speedoColors = handleLocalStorage("speedoColors","get") diff --git a/web/src/Utils/Translate.js b/web/src/Utils/Translate.js index d47ed4e..0d13569 100644 --- a/web/src/Utils/Translate.js +++ b/web/src/Utils/Translate.js @@ -7,7 +7,7 @@ import TranslateData from '../assets/translate.json'; * @param defaultKey (optional) return default string if doesn't exist key * @return {*} */ -let lang = "EN" +let lang = "en" export const translate = (translateKey,translateObjectName = "General",defaultKey = null) =>{ if(!TranslateData[lang][translateObjectName][translateKey.toLowerCase()]){ console.warn(`Doesn't exist translate key: ${translateKey.toLowerCase()} in ${translateObjectName} translate object`) @@ -17,10 +17,10 @@ export const translate = (translateKey,translateObjectName = "General",defaultKe } export function setLang(currentLang){ - let newLang = currentLang.length > 0 ? currentLang : "EN" + let newLang = currentLang.length > 0 ? currentLang : "en" if(!TranslateData[currentLang]){ console.warn(`There is no such language type! Current language type: ${currentLang} If you want add other lang you can do here: web/src/assets/translate.json !!IMPORTANT this file only see with the unbuilt version.`) - newLang = "EN" + newLang = "en" } lang = newLang } \ No newline at end of file diff --git a/web/src/assets/translate.json b/web/src/assets/translate.json index ebe9cb6..034ae2d 100644 --- a/web/src/assets/translate.json +++ b/web/src/assets/translate.json @@ -1,5 +1,5 @@ { - "EN": { + "en": { "General": { "status": "Status", "speedo": "Speedometer", @@ -64,7 +64,7 @@ "passengerspeedo":"Passenger speedo ON/OFF" } }, - "DE": { + "de": { "General": { "status": "Status", "speedo": "Geschwindigkeitszähler", @@ -128,7 +128,7 @@ "passengerspeedo":"Beifahrer Tacho AN/AUS" } }, - "HU": { + "hu": { "General": { "status": "Státusz", "speedo": "Sebességmérő", @@ -193,7 +193,7 @@ "passengerspeedo":"Kilóméter óra anyós ülésen BE/KI" } }, - "SR": { + "sr": { "General": { "status": "Status", "speedo": "Brzinometar", From a6996d7a3dee8179c0ee67e44cf39aef7b4cc2b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horv=C3=A1th=20Gell=C3=A9rt?= Date: Sat, 29 Apr 2023 12:53:40 +0200 Subject: [PATCH 2/2] :art: little design changes --- web/src/assets/Components/SettingsPanel/SettingsPanel.jsx | 2 +- web/src/index.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/assets/Components/SettingsPanel/SettingsPanel.jsx b/web/src/assets/Components/SettingsPanel/SettingsPanel.jsx index db0bf87..69a3d48 100644 --- a/web/src/assets/Components/SettingsPanel/SettingsPanel.jsx +++ b/web/src/assets/Components/SettingsPanel/SettingsPanel.jsx @@ -147,7 +147,7 @@ export const SettingsPanel = () =>{ return( <> -
+
diff --git a/web/src/index.css b/web/src/index.css index f8a9dfc..eef32b9 100644 --- a/web/src/index.css +++ b/web/src/index.css @@ -27,7 +27,7 @@ } .speedo { - @apply absolute bottom-0 right-8 + @apply absolute bottom-4 right-8 } }