mirror of
https://github.com/roflmuffin/CounterStrikeSharp.git
synced 2025-12-08 08:56:34 -08:00
23 lines
829 B
C#
23 lines
829 B
C#
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using Microsoft.Extensions.Localization;
|
|
|
|
namespace CounterStrikeSharp.API.Core.Translations;
|
|
|
|
internal class StringLocalizer : IStringLocalizer
|
|
{
|
|
private IStringLocalizer _localizer;
|
|
|
|
public StringLocalizer(IStringLocalizerFactory factory)
|
|
{
|
|
var type = typeof(StringLocalizer);
|
|
var assemblyName = new AssemblyName(type.GetTypeInfo().Assembly.FullName);
|
|
_localizer = factory.Create(string.Empty, assemblyName.FullName);
|
|
}
|
|
|
|
public LocalizedString this[string name] => _localizer[name];
|
|
|
|
public LocalizedString this[string name, params object[] arguments] => _localizer[name, arguments];
|
|
|
|
public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures) => _localizer.GetAllStrings(includeParentCultures);
|
|
} |