fix tw
This commit is contained in:
parent
fccdc8ca1f
commit
f3686b23c7
@ -83,16 +83,17 @@ pub const LANGS: &[(&str, &str)] = &[
|
|||||||
|
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
pub fn translate(name: String) -> String {
|
pub fn translate(name: String) -> String {
|
||||||
let locale = sys_locale::get_locale().unwrap_or_default().to_lowercase();
|
let locale = sys_locale::get_locale().unwrap_or_default();
|
||||||
translate_locale(name, &locale)
|
translate_locale(name, &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn translate_locale(name: String, locale: &str) -> String {
|
pub fn translate_locale(name: String, locale: &str) -> String {
|
||||||
|
let locale = locale.to_lowercase();
|
||||||
let mut lang = hbb_common::config::LocalConfig::get_option("lang").to_lowercase();
|
let mut lang = hbb_common::config::LocalConfig::get_option("lang").to_lowercase();
|
||||||
if lang.is_empty() {
|
if lang.is_empty() {
|
||||||
// zh_CN on Linux, zh-Hans-CN on mac, zh_CN_#Hans on Android
|
// zh_CN on Linux, zh-Hans-CN on mac, zh_CN_#Hans on Android
|
||||||
if locale.starts_with("zh") {
|
if locale.starts_with("zh") {
|
||||||
lang = (if locale.contains("TW") {
|
lang = (if locale.contains("tw") {
|
||||||
"zh-tw"
|
"zh-tw"
|
||||||
} else {
|
} else {
|
||||||
"zh-cn"
|
"zh-cn"
|
||||||
|
Loading…
Reference in New Issue
Block a user