jellyfin/Emby.Server.Core/Localization/TextLocalizer.cs

26 lines
732 B
C#
Raw Normal View History

2016-11-05 02:17:18 +00:00
using System;
using System.Globalization;
using System.Linq;
using System.Text;
using Emby.Server.Implementations.Localization;
2016-11-11 07:24:36 +00:00
namespace Emby.Server.Core.Localization
2016-11-05 02:17:18 +00:00
{
public class TextLocalizer : ITextLocalizer
{
public string RemoveDiacritics(string text)
{
return String.Concat(
text.Normalize(NormalizationForm.FormD)
.Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) !=
UnicodeCategory.NonSpacingMark)
).Normalize(NormalizationForm.FormC);
}
public string NormalizeFormKD(string text)
{
return text.Normalize(NormalizationForm.FormKD);
}
}
}