Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use static references for localization, remove live localization updates #613

Merged
merged 9 commits into from
Sep 7, 2023

Conversation

Al12rs
Copy link
Contributor

@Al12rs Al12rs commented Sep 6, 2023

close #601

This PR removes live localization updates support and uses static compile safe references in axaml code.

  • Changed all axaml references to static compile safe one that won't update on locale change.
  • Removed all custom string update code required for live updating of strings both in the views and the C# code.
  • Updated Docs to reflect the new simplified approach.
  • Added ADR about not supporting live update of localized strings and asking users to restart the app instead.
  • Moved a localized string referemce from XAML file to views to make it update.
  • Removed the tests that checked if live translation changes worked correctly.

During implementation, a limitation of xaml stylesheet static references was found.
These are loaded before the locale is configured at startup, meaning that any localized strings referenced in these files will remain the default English even with restarts.
Localized strings can thus not be used in XAML stylesheet files.

I made cursory checks using Italian translations and things seem to work correctly.

@Al12rs Al12rs self-assigned this Sep 6, 2023
@Al12rs Al12rs requested a review from a team September 6, 2023 10:46
@codecov
Copy link

codecov bot commented Sep 6, 2023

Codecov Report

Merging #613 (10acde0) into main (b58cc97) will increase coverage by 68.12%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff            @@
##           main     #613       +/-   ##
=========================================
+ Coverage      0   68.12%   +68.12%     
=========================================
  Files         0      597      +597     
  Lines         0    16408    +16408     
  Branches      0     1086     +1086     
=========================================
+ Hits          0    11178    +11178     
- Misses        0     4954     +4954     
- Partials      0      276      +276     
Flag Coverage Δ
Linux 67.40% <71.42%> (?)
Windows 67.30% <71.42%> (?)
clean_environment_tests 68.11% <71.42%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage
src/NexusMods.App.UI/App.axaml.cs 0.00%
...Controls/Buttons/RoundedButton/RoundedButton.axaml 0.00%
...usMods.App.UI/Controls/GameWidget/GameWidget.axaml 0.00%
src/NexusMods.App.UI/Controls/Pills/Premium.axaml 0.00%
...pp.UI/LeftMenu/Game/GameLeftMenuDesignViewModel.cs 0.00%
...ys/Download/Cancel/CancelDownloadOverlayView.axaml 0.00%
....App.UI/Overlays/Login/NexusLoginOverlayView.axaml 0.00%
....App.UI/RightContent/Downloads/CompletedView.axaml 0.00%
...ds.App.UI/RightContent/Downloads/HistoryView.axaml 0.00%
...tent/Downloads/ViewModels/DownloadTaskViewModel.cs ø
... and 16 more
@halgari halgari merged commit c0a63a5 into main Sep 7, 2023
5 checks passed
@halgari halgari deleted the static-localization branch September 7, 2023 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants