Skip to content

Commit

Permalink
fix lazy init always en
Browse files Browse the repository at this point in the history
Co-authored-by: yk0n9 <[email protected]>
Co-authored-by: KKRainbow <[email protected]>
  • Loading branch information
yk0n9 and KKRainbow committed Aug 20, 2024
1 parent 4e21836 commit c9d5579
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,12 @@ fn generate_code(

let default_locale = if let Some(default_locale) = args.default_locale {
quote! {
rust_i18n::set_locale(#default_locale);
use std::ops::Deref;
if #default_locale != rust_i18n::locale().deref() {
rust_i18n::set_locale(rust_i18n::locale().deref());
} else {
rust_i18n::set_locale(#default_locale);
}
}
} else {
quote! {}
Expand Down

0 comments on commit c9d5579

Please sign in to comment.