From 34a9f1b0d5e0ce29ba88bde12152c87c7a96aef0 Mon Sep 17 00:00:00 2001 From: Uniixx Date: Sun, 12 Apr 2020 17:29:00 -0400 Subject: [PATCH] Multiple languages support Supports many languages such as French, English and Polish (used Google Translate) Also fixed a typo in the readme and added instructions on how to change the language. Sorry I had to repush again due to my last repository being broke. --- esx_kashacters/fxmanifest.lua | 3 +++ esx_kashacters/html/js/app.js | 4 ++-- esx_kashacters/html/locales/en.js | 12 ++++++++++++ esx_kashacters/html/locales/fr.js | 12 ++++++++++++ esx_kashacters/html/locales/pl.js | 12 ++++++++++++ esx_kashacters/html/ui.html | 19 +++++++++++++++---- readme-pl.md | 3 +++ readme.md | 5 ++++- 8 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 esx_kashacters/html/locales/en.js create mode 100644 esx_kashacters/html/locales/fr.js create mode 100644 esx_kashacters/html/locales/pl.js diff --git a/esx_kashacters/fxmanifest.lua b/esx_kashacters/fxmanifest.lua index 4a1064b0..bcb3e2b9 100644 --- a/esx_kashacters/fxmanifest.lua +++ b/esx_kashacters/fxmanifest.lua @@ -19,6 +19,9 @@ files { 'html/ui.html', 'html/css/main.css', 'html/js/app.js', + 'html/locales/fr.js', + 'html/locales/en.js', + 'html/locales/pl.js', } dependency 'es_extended' diff --git a/esx_kashacters/html/js/app.js b/esx_kashacters/html/js/app.js index e01f864c..7116b356 100644 --- a/esx_kashacters/html/js/app.js +++ b/esx_kashacters/html/js/app.js @@ -47,7 +47,7 @@ $("#deletechar").click(function () { $.each(data.characters, function (index, char) { if (char.charid !== 0) { var charid = char.identifier.charAt(4); - $('[data-charid=' + charid + ']').html('

'+ char.firstname +' '+ char.lastname +'

Work: '+ char.job +'

Cash: '+ char.money +'

Bank: '+ char.bank +'

Date of birth: '+ char.dateofbirth +'

Gender: '+ char.sex +'

').attr("data-ischar", "true"); + $('[data-charid=' + charid + ']').html('

' + char.firstname + ' ' + char.lastname + '

' + `${translate.job}: ` + '' + char.job + '

' + `${translate.money}: ` + '' + char.money + '

' + `${translate.bank}: ` + '' + char.bank + '

' + `${translate.dob}: ` + '' + char.dateofbirth + '

' + `${translate.gender}: ` + ''+ char.sex +'

').attr("data-ischar", "true"); } }); } @@ -57,7 +57,7 @@ $("#deletechar").click(function () { $('.main-container').css({"display":"none"}); $(".character-box").removeClass('active-char'); $("#delete").css({"display":"none"}); - $(".character-box").html('

Create new character

').attr("data-ischar", "false"); + $(".character-box").html('

' + `${translate.new}` + '

').attr("data-ischar", "false"); }; window.onload = function(e) { window.addEventListener('message', function(event) { diff --git a/esx_kashacters/html/locales/en.js b/esx_kashacters/html/locales/en.js new file mode 100644 index 00000000..7a6acfe2 --- /dev/null +++ b/esx_kashacters/html/locales/en.js @@ -0,0 +1,12 @@ +const translate = new Object(); + +translate.job = "Job"; +translate.bank = "Bank"; +translate.money = "Cash"; +translate.gender = "Gender"; +translate.dob = "Date of birth"; +translate.new = "Create new character"; +translate.delete = "DELETE"; +translate.play = "PLAY"; +translate.modalTitle = "Are You Sure?"; +translate.modalText = "By deleting your account we won't be able to recover it, all properties, cars etc. will be deleted"; \ No newline at end of file diff --git a/esx_kashacters/html/locales/fr.js b/esx_kashacters/html/locales/fr.js new file mode 100644 index 00000000..79059b34 --- /dev/null +++ b/esx_kashacters/html/locales/fr.js @@ -0,0 +1,12 @@ +const translate = new Object(); + +translate.job = "Métier"; +translate.bank = "Banque"; +translate.money = "Argent"; +translate.gender = "Sexe"; +translate.dob = "Date de naissance"; +translate.new = "Créer un personnage"; +translate.delete = "SUPPRIMER"; +translate.play = "JOUER"; +translate.modalTitle = "Êtes-vous sûr?"; +translate.modalText = "En supprimant votre personnage, vous ne pourrez pas le récupérer. Toutes les informations seront supprimées."; \ No newline at end of file diff --git a/esx_kashacters/html/locales/pl.js b/esx_kashacters/html/locales/pl.js new file mode 100644 index 00000000..9661de05 --- /dev/null +++ b/esx_kashacters/html/locales/pl.js @@ -0,0 +1,12 @@ +const translate = new Object(); + +translate.job = "Zajęcie"; +translate.bank = "Bank"; +translate.money = "Gotówka"; +translate.gender = "Seks"; +translate.dob = "Data urodzenia"; +translate.new = "Utwórz nową postać"; +translate.delete = "KASOWAĆ"; +translate.play = "GRAĆ"; +translate.modalTitle = "Jesteś pewny?"; +translate.modalText = "Po usunięciu konta nie będziemy mogli go odzyskać, wszystkie nieruchomości, samochody itp. Zostaną usunięte"; \ No newline at end of file diff --git a/esx_kashacters/html/ui.html b/esx_kashacters/html/ui.html index 3e5df858..2c631072 100644 --- a/esx_kashacters/html/ui.html +++ b/esx_kashacters/html/ui.html @@ -7,6 +7,7 @@ + @@ -16,7 +17,7 @@

-

Create new character

+

@@ -51,9 +52,9 @@