Skip to content

Commit

Permalink
Implement suggested fixes to rendering issues when changing locale.
Browse files Browse the repository at this point in the history
Reference: #226 (review)
  • Loading branch information
hydra committed Nov 28, 2024
1 parent 7b1f818 commit dbb42f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,6 @@ impl<'context> WidgetContext<'context> {
if let Some(locale) = overridden_locale {
context.locale = locale
}
context.locale.invalidate_when_changed(&context);
context.locale.redraw_when_changed(&context);

context
}
Expand Down Expand Up @@ -1292,7 +1290,7 @@ impl<'context> WidgetContext<'context> {
pub fn translation(
&self
) -> &FluentBundle<FluentResource> {
if let Some(bundle) = self.translations.loaded_translations.get(&self.locale.get()) {
if let Some(bundle) = self.translations.loaded_translations.get(&self.locale.get_tracking_invalidate(self)) {
bundle
} else {
self.translations.loaded_translations.get(&self.translations.fallback_locale).unwrap()
Expand Down
2 changes: 1 addition & 1 deletion src/localization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl DynamicDisplay for Localize<'static> {
}

fn fmt(&self, context: &WidgetContext<'_>, f: &mut Formatter<'_>) -> fmt::Result {
let locale = context.locale().get();
let locale = context.locale().get_tracking_invalidate(context);
println!("{:?}", locale);

let bundle = context.translation();
Expand Down

0 comments on commit dbb42f6

Please sign in to comment.