Skip to content

Commit 6479786

Browse files
committed
accept all isolang formats
1 parent abc5b9c commit 6479786

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tmc-langs-cli/src/main.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,9 +873,13 @@ fn into_usize(arg: &str) -> usize {
873873
}
874874

875875
fn into_locale(arg: &str) -> Language {
876-
Language::from_639_3(arg).unwrap_or_else(|| {
877-
Error::with_description(&format!("Invalid locale: {}", arg), ErrorKind::InvalidValue).exit()
878-
})
876+
Language::from_locale(arg)
877+
.or(Language::from_639_1(arg))
878+
.or(Language::from_639_3(arg))
879+
.unwrap_or_else(|| {
880+
Error::with_description(&format!("Invalid locale: {}", arg), ErrorKind::InvalidValue)
881+
.exit()
882+
})
879883
}
880884

881885
fn into_url(arg: &str) -> Url {

0 commit comments

Comments
 (0)