Skip to content

Commit

Permalink
Add function to check if localization culture was already loaded. (#5603
Browse files Browse the repository at this point in the history
)
  • Loading branch information
c4llv07e authored Jan 16, 2025
1 parent 6a3f88b commit 039468f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Robust.Shared/Localization/ILocalizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ public interface ILocalizationManager
/// </summary>
CultureInfo? DefaultCulture { get; set; }

/// <summary>
/// Checks if the culture has been loaded.
/// </summary>
/// <param name="culture"></param>
bool HasCulture(CultureInfo culture);

/// <summary>
/// Load data for a culture.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Robust.Shared/Localization/LocalizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ public CultureInfo? DefaultCulture
}
}

public bool HasCulture(CultureInfo culture)
{
return _contexts.ContainsKey(culture);
}

public void LoadCulture(CultureInfo culture)
{
var bundle = LinguiniBuilder.Builder()
Expand Down

0 comments on commit 039468f

Please sign in to comment.