Skip to content

Commit

Permalink
Fixing Localization issues
Browse files Browse the repository at this point in the history
I noticed and fixed two issues with the localization setup. First it seemed that the Languages wasn't getting properly loaded from the save file. I believe this was because it was just a variable, not a property. Changing it to a property fixed it for me.
Second, I saw it was throwing an error if it did try to load a save file with the language other than English, because Language.Current.Use gets called before the save file is loaded during Assets.Load, so it just uses the default. It needs to get called after the save file is loaded instead of as well, to get around this error.
  • Loading branch information
jasminegamedev committed Feb 8, 2024
1 parent 434d7ff commit 2e11b11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Data/Save.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public int IncFlag(string name)
/// <summary>
/// Current Language ID
/// </summary>
public string Language = "english";
public string Language { get; set; } = "english";

/// <summary>
/// Records for each level
Expand Down
4 changes: 4 additions & 0 deletions Source/Scenes/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ private void BeginGame()
Save.Instance.SyncSettings();
}

// make sure the active language is ready for use,
// since the save file may have loaded a different language than default.
Language.Current.Use();

// try to load controls, or overwrite with defaults if they don't exist
{
var controlsFile = Path.Join(App.UserPath, ControlsConfig.FileName);
Expand Down

0 comments on commit 2e11b11

Please sign in to comment.