49 lines
841 B
C#
49 lines
841 B
C#
using Microsoft.Extensions.Localization;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IRaCIS.Core.Infrastructure.Extention;
|
|
|
|
public static class I18n
|
|
{
|
|
private static IStringLocalizer _localizer;
|
|
|
|
public static void SetLocalizer(IStringLocalizer localizer)
|
|
{
|
|
_localizer = localizer;
|
|
}
|
|
|
|
|
|
|
|
public static string T(string key)
|
|
{
|
|
if(_localizer is null)
|
|
{
|
|
return key;
|
|
}
|
|
else
|
|
{
|
|
return _localizer[key];
|
|
|
|
}
|
|
}
|
|
|
|
public static string T(string key, params object[] arguments)
|
|
{
|
|
if (_localizer is null)
|
|
{
|
|
return key;
|
|
}
|
|
else
|
|
{
|
|
return _localizer[key, arguments];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|