Skip to content

Commit

Permalink
add set language function
Browse files Browse the repository at this point in the history
  • Loading branch information
szaaamerik committed Jan 13, 2024
1 parent 0b16235 commit 5df81c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
16 changes: 3 additions & 13 deletions Forza-Mods-AIO/Resources/TranslateUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,13 @@ namespace Forza_Mods_AIO.Resources;

public class TranslateUtil
{
private readonly Dictionary<string, string> _translation;
public TranslateUtil(Dictionary<string, string> translation)
private Dictionary<string, string> _translation = new();

public void SetLanguage(Dictionary<string, string> translation)
{
if (_translation != null && _translation == translation)
{
return;
}

_translation = translation;
}

public TranslateUtil()
{
_translation = null!;
}

private class OriginalValues
{
public string Content { get; set; } = string.Empty;
Expand Down
4 changes: 2 additions & 2 deletions Forza-Mods-AIO/Tabs/AIO-Info/AIO-Info.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void Button_OnMouseDown(object sender, MouseButtonEventArgs e)
}
}

private TranslateUtil _translateUtil = new();
private readonly TranslateUtil _translateUtil = new();

private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
Expand All @@ -86,7 +86,7 @@ private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArg
}
case 1: // chinese
{
_translateUtil = new TranslateUtil(Translations.ChineseTranslate);
_translateUtil.SetLanguage(Translations.ChineseTranslate);
_translateUtil.Translate();
break;
}
Expand Down

0 comments on commit 5df81c7

Please sign in to comment.