Skip to content

Commit

Permalink
Fix lazy init always "en" (#88)
Browse files Browse the repository at this point in the history
close #87

---------

Co-authored-by: KKRainbow <[email protected]>
Co-authored-by: Jason Lee <[email protected]>
  • Loading branch information
3 people authored Aug 20, 2024
1 parent d4b7f37 commit 52033e7
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());

This comment has been minimized.

Copy link
@KKRainbow

KKRainbow Aug 21, 2024

Author Contributor

will this change cause default_locale do nothing

} else {
rust_i18n::set_locale(#default_locale);
}
}
} else {
quote! {}
Expand Down

0 comments on commit 52033e7

Please sign in to comment.