Skip to content

Commit

Permalink
Clarify parameters for "Localize" method in ILocalizer;
Browse files Browse the repository at this point in the history
Bump to version 1.1.7;
  • Loading branch information
onepiecefreak3 committed Oct 1, 2024
1 parent 2561c28 commit fd4d480
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ImGui.Forms/ImGui.Forms.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>Imgui.Forms</id>
<version>1.1.6</version>
<version>1.1.7</version>
<description>A WinForms-inspired object-oriented framework around Dear ImGui (https://github.com/ocornut/imgui)</description>

<authors>onepiecefreak</authors>
Expand Down
6 changes: 3 additions & 3 deletions ImGui.Forms/Localization/BaseLocalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ public void ChangeLocale(string locale)
SetCurrentLocale(locale);
}

public string Localize(string name, params object[] args)
public string Localize(string localizationId, params object[] args)
{
// Return localization of current locale
if (_localizations.TryGetValue(CurrentLocale, out LanguageInfo language)
&& language.LocalizationEntries.TryGetValue(name, out string localization))
&& language.LocalizationEntries.TryGetValue(localizationId, out string localization))
return string.Format(localization, args);

// Otherwise, return localization of default locale
if (_localizations.TryGetValue(DefaultLocale, out language)
&& language.LocalizationEntries.TryGetValue(name, out localization))
&& language.LocalizationEntries.TryGetValue(localizationId, out localization))
return string.Format(localization, args);

// Otherwise, return localization placeholder
Expand Down
2 changes: 1 addition & 1 deletion ImGui.Forms/Localization/ILocalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public interface ILocalizer
string GetLanguageName(string locale);
void ChangeLocale(string locale);

string Localize(string name, params object[] args);
string Localize(string localizationId, params object[] args);
}
}

0 comments on commit fd4d480

Please sign in to comment.