Skip to content

Commit 52033e7

Browse files
yk0n9KKRainbowhuacnlee
authored
Fix lazy init always "en" (#88)
close #87 --------- Co-authored-by: KKRainbow <sijie.sun@smartx.com> Co-authored-by: Jason Lee <huacnlee@gmail.com>
1 parent d4b7f37 commit 52033e7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/macro/src/lib.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,12 @@ fn generate_code(
292292

293293
let default_locale = if let Some(default_locale) = args.default_locale {
294294
quote! {
295-
rust_i18n::set_locale(#default_locale);
295+
use std::ops::Deref;
296+
if #default_locale != rust_i18n::locale().deref() {
297+
rust_i18n::set_locale(rust_i18n::locale().deref());
298+
} else {
299+
rust_i18n::set_locale(#default_locale);
300+
}
296301
}
297302
} else {
298303
quote! {}

0 commit comments

Comments
 (0)