-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add_indonesia_localisation_data
- Loading branch information
Showing
18 changed files
with
1,342 additions
and
181 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,50 @@ | ||
use chardet::{charset2encoding, detect}; | ||
use charset_normalizer_rs::from_bytes; | ||
use encoding::label::encoding_from_whatwg_label; | ||
use encoding::DecoderTrap; | ||
|
||
pub fn decode_buffer(buf: Vec<u8>) -> String { | ||
let result = detect(&buf); | ||
let mut str_encoding = charset2encoding(&result.0); | ||
// let's just say it's cp1251 if encoding is not detected | ||
// FIXME: find a way to actually detect cp1251 and cp1252 from together | ||
pub fn decode_buffer(buf: Vec<u8>) -> (String, String, String) { | ||
let buff_output: String; | ||
let first_encoding: String; | ||
let second_encoding: String; | ||
let mut str_encoding: String; | ||
|
||
if result.0 == "MacCyrillic" | ||
|| (result.0 == "KOI8-R" && result.1 < 0.7 && result.2 == "Russian") | ||
// chardet | ||
first_encoding = charset2encoding(&detect(&buf).0).to_string(); | ||
|
||
// charset_normalizer_rs | ||
second_encoding = match from_bytes(&buf, None).get_best() { | ||
Some(cd) => cd.encoding().to_string(), | ||
None => "not_found".to_string(), | ||
}; | ||
|
||
str_encoding = first_encoding.clone(); | ||
|
||
if first_encoding == "KOI8-R" | ||
|| first_encoding == "MacCyrillic" | ||
|| first_encoding == "x-mac-cyrillic" | ||
{ | ||
str_encoding = "cp1251"; | ||
str_encoding = "cp1251".to_string(); | ||
} | ||
|
||
if str_encoding.len() < 1 { | ||
str_encoding = "cp1251"; | ||
if second_encoding == "koi8-r" || second_encoding == "macintosh" || second_encoding == "ibm866" | ||
{ | ||
str_encoding = "cp1251".to_string(); | ||
} | ||
|
||
let coder = encoding_from_whatwg_label(str_encoding); | ||
// if str_encoding.len() < 1 { | ||
// str_encoding = "cp1251".to_string(); | ||
// } | ||
|
||
let coder = encoding_from_whatwg_label(str_encoding.as_str()); | ||
if coder.is_some() { | ||
coder | ||
buff_output = coder | ||
.unwrap() | ||
.decode(&buf, DecoderTrap::Ignore) | ||
.expect("Error") | ||
.expect("Error"); | ||
} else { | ||
String::from_utf8_lossy(buf.as_slice()).to_string() | ||
buff_output = String::from_utf8_lossy(buf.as_slice()).to_string(); | ||
} | ||
|
||
(buff_output, first_encoding, second_encoding) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
export default { | ||
favorites: "Favoriti", | ||
internet: "Internet", | ||
partners: "Partneri", | ||
recently_joined: "Nedavno posjećen", | ||
nickname: "Nadimak", | ||
settings: "Postavke", | ||
minimize: "Minimiziraj", | ||
maximize: "Maksimiziraj", | ||
close: "Zatvori", | ||
add_server_modal_description_1: "Dodaj server ručno na svoju listu favorita.", | ||
add_server_modal_description_2: "Primjer: 127.0.0.1:7777", | ||
add: "Dodaj", | ||
server: "Server", | ||
address: "Adresa", | ||
players: "Igrači", | ||
server_join_prompt_enter_password: | ||
"Ovaj server je zaštićen, molimo da unesete lozinku.", | ||
server_join_prompt_enter_password_input_placeholder: "Unesi lozinku...", | ||
server_join_prompt_nickname_input_placeholder: "Unesi nadimak...", | ||
connect: "Konektuj", | ||
copy: "Kopiraj", | ||
remove_from_favorites: "Izbriši iz Favorita", | ||
add_to_favorites: "Dodaj u Favorite", | ||
filters: "Filteri", | ||
filter_only_omp_servers: "Samo open.mp serveri", | ||
filter_non_empty_servers: "Neprazni Serveri", | ||
filter_unpassworded_servers: "Serveri bez lozinke", | ||
rule: "Pravilo", | ||
value: "Vrijednost", | ||
player: "Igrač", | ||
score: "Rezultat", | ||
locked: "Zaključano", | ||
unlocked: "Otključano", | ||
openmp_server: "open.mp server", | ||
name: "Ime", | ||
ping: "Ping", | ||
mode: "Mode", | ||
filter_servers: "Filtriraj Servere", | ||
search_for_server_hostname_mode: "Pretraži za ime/mode servera", | ||
clear_recently_joined_list: "Izbriši Nedavno Posjećene Servere", | ||
refresh_servers: "Osvježi Server Listu", | ||
play: "Igraj", | ||
remove_selected_server_from_favorites: | ||
"Ukloni Izabrani Server iz Favorita", | ||
add_selected_server_to_favorites: "Dodaj Izabrani Server u Favorite", | ||
add_server: "Dodaj Server", | ||
hide_player_and_rule_list: "Sakrij listu igrača i pravila", | ||
show_player_and_rule_list: "Prikaži listu igrača i pravila", | ||
copy_server_info: "Kopiraj Server Info", | ||
settings_gta_path_input_label: | ||
"Lokacija GTA: San Andreas-a (gdje je SA-MP također instaliran)", | ||
browse: "Pretraži", | ||
settings_import_nickname_gta_path_from_samp: | ||
"Prenesi nadimak i GTA SA lokaciju iz SA-MP postavki", | ||
settings_import_samp_favorite_list: "Prenesi listu favorita iz SA-MP podataka", | ||
settings_reset_application_data: | ||
"Restartuj podatke aplikacije (očisti postavke i liste)", | ||
settings_new_update_available: "⚠ Novo ažuriranje dostupno. Klikni da skineš! ⚠", | ||
settings_credits_made_by: "Napravio s ❤️", | ||
settings_credits_view_source_on_github: "Pogledaj izvorni kod na GitHub-u", | ||
update_modal_update_available_title: "Dostupno ažuriranje!", | ||
update_modal_update_available_description: | ||
'Dostupan je novi build launcher-a!\nBuild verzija tvoga launhcer-a: {{ version }}\nTrenutna build verzija launcher-a: {{ newVersion }}\nKlikni "Skini" da otvorite stranicu izdanja', | ||
download: "Skini", | ||
update_modal_remind_me_next_time: "Podjseti Me Slijedeći Put", | ||
update_modal_skip_this_update: "Preskoči Ovo Ažuriranje", | ||
gta_path_modal_cant_find_game_title: "GTA San Andreas nije pronađen!", | ||
gta_path_modal_cant_find_game_description: | ||
'GTA San Andreas nije pronađen u ovom direktoriju:\n - "{{ path }}"\n"gta_sa.exe" nije pronađen u datom direktoriju.', | ||
open_settings: "Otvori Postavke", | ||
cancel: "Otkaži", | ||
gta_path_modal_cant_find_samp_title: "SA-MP nije pronađen!", | ||
gta_path_modal_cant_find_samp_description: | ||
'SA-MP instalacija nije pronađena u ovom direktoriju:\n - "{{ path }}"\n"samp.dll" nije pronađen u datom direktoriju.\n\nAko nemaš instaliran SA-MP, možeš ga skinuti sa https://sa-mp.mp/ klikom na **Skini**', | ||
notification_add_to_favorites_title: "Dodan u Favorite!", | ||
notification_add_to_favorites_description: | ||
"{{ server }} je dodan u tvoju listu favorita.", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.