Skip to content

Commit

Permalink
Add dynamic language switching support and UI refresh mechanism.
Browse files Browse the repository at this point in the history
- Implemented dynamic resource reloading for language changes using CultureInfo.
- Added `ChangeLanguage` method in `ConfigViewModel` to update resource culture.
- Enhanced `MainViewModel` to propagate language updates and refresh the UI.
- Updated XAML bindings to use dynamic resource paths for localization.
- Ensured language settings (Polish and English) are applied immediately upon selection.
- Integrated `RefreshUI` to invalidate visuals and redraw the UI after language changes.
- Refined `ConfigWindow` to include language selection dropdown in settings.
- Verified resource files (`Resources.resx` and `Resources.pl.resx`) for consistency.
  • Loading branch information
mateusz-kierepka-hl committed Dec 27, 2024
1 parent 9b9a021 commit 9b24d93
Show file tree
Hide file tree
Showing 14 changed files with 1,443 additions and 461 deletions.
1 change: 1 addition & 0 deletions .idea/.idea.ChatAAC/.idea/avalonia.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ChatAAC/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using ChatAAC.ViewModels;
using ChatAAC.Views;
using ReactiveUI;
using System.Globalization;

namespace ChatAAC;

Expand All @@ -20,6 +21,9 @@ public override void Initialize()

public override void OnFrameworkInitializationCompleted()
{
// Ustawienie kultury na aktualną kulturę systemową
Lang.Resources.Culture = CultureInfo.CurrentCulture;

if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
desktop.MainWindow = new MainWindow
{
Expand Down
15 changes: 15 additions & 0 deletions ChatAAC/ChatAAC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,19 @@
<ItemGroup>
<Folder Include="Assets\Categories\"/>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Lang\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Compile Update="Lang\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
</Project>
Loading

0 comments on commit 9b24d93

Please sign in to comment.