Skip to content

Commit

Permalink
fix lazy init always "en"
Browse files Browse the repository at this point in the history
  • Loading branch information
yk0n9 committed Aug 20, 2024
1 parent 4e21836 commit 1a9f7ec
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 1a9f7ec

Please sign in to comment.