Skip to content

Commit

Permalink
Merge pull request #45 from Gellipapa/main
Browse files Browse the repository at this point in the history
🔧 fix(Translation locales)
  • Loading branch information
TheFantomas authored Apr 29, 2023
2 parents ba1999b + bebf169 commit 3ea5e48
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion shared/config.lua
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion web/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions web/src/Utils/Translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion web/src/assets/Components/SettingsPanel/SettingsPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const SettingsPanel = () =>{

return(
<>
<div class={`relative bg-[#17191A] w-[600px] h-[650px] rounded-[25px] ease-in duration-500 z-30 ${showPanel() ? 'slideDown' : 'slideUp'}`}>
<div class={`relative bg-[#17191A] w-[600px] rounded-[25px] pb-4 ease-in duration-500 z-30 ${showPanel() ? 'slideDown' : 'slideUp'}`}>
<MainPage currentPath={currentPath} onMenuClick={handleMenuClick}/>
<SaveResetButtons toggleShowPanel={toggleShowPanel} showEdit={showEdit()} currentSelectedMenu={selectedMenuName()} selectedName={currentSelectedElementName()} onSaveAndResetButtonClick={handleClickSaveAndReset}/>
<Routes>
Expand Down
8 changes: 4 additions & 4 deletions web/src/assets/translate.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"EN": {
"en": {
"General": {
"status": "Status",
"speedo": "Speedometer",
Expand Down Expand Up @@ -64,7 +64,7 @@
"passengerspeedo":"Passenger speedo ON/OFF"
}
},
"DE": {
"de": {
"General": {
"status": "Status",
"speedo": "Geschwindigkeitszähler",
Expand Down Expand Up @@ -129,7 +129,7 @@
"passengerspeedo":"Beifahrer Tacho AN/AUS"
}
},
"HU": {
"hu": {
"General": {
"status": "Státusz",
"speedo": "Sebességmérő",
Expand Down Expand Up @@ -194,7 +194,7 @@
"passengerspeedo":"Kilóméter óra anyós ülésen BE/KI"
}
},
"SR": {
"sr": {
"General": {
"status": "Status",
"speedo": "Brzinometar",
Expand Down
2 changes: 1 addition & 1 deletion web/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

.speedo {
@apply absolute bottom-0 right-8
@apply absolute bottom-4 right-8
}

}
Expand Down

0 comments on commit 3ea5e48

Please sign in to comment.