Fixed translate crashing on unknown language code, added Ewe
This commit is contained in:
@@ -56,6 +56,7 @@ fn init(config_dir: RString) -> State {
|
|||||||
("nl", "Dutch"),
|
("nl", "Dutch"),
|
||||||
("en", "English"),
|
("en", "English"),
|
||||||
("eo", "Esperanto"),
|
("eo", "Esperanto"),
|
||||||
|
("ee", "Ewe"),
|
||||||
("et", "Estonian"),
|
("et", "Estonian"),
|
||||||
("tl", "Filipino"),
|
("tl", "Filipino"),
|
||||||
("fi", "Finnish"),
|
("fi", "Finnish"),
|
||||||
@@ -216,10 +217,10 @@ fn get_matches(input: RString, data: &State) -> RVec<Match> {
|
|||||||
"{} -> {}",
|
"{} -> {}",
|
||||||
data.langs.iter()
|
data.langs.iter()
|
||||||
.find_map(|(code, name)| if *code == json[2].as_str().expect("Malformed JSON!") {
|
.find_map(|(code, name)| if *code == json[2].as_str().expect("Malformed JSON!") {
|
||||||
Some(name)
|
Some(*name)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}).expect("Google API returned unknown language code!"),
|
}).unwrap_or_else(|| json[2].as_str().expect("Malformed JSON!")),
|
||||||
name)
|
name)
|
||||||
.into()),
|
.into()),
|
||||||
use_pango: false,
|
use_pango: false,
|
||||||
|
Reference in New Issue
Block a user