From 3c1447804b5de9a7d840c7158c3cb4e0a27f76e1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 4 Nov 2016 22:17:18 -0400 Subject: move localization classes --- .../TextLocalizer.cs | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 MediaBrowser.Server.Startup.Common/TextLocalizer.cs (limited to 'MediaBrowser.Server.Startup.Common/TextLocalizer.cs') diff --git a/MediaBrowser.Server.Startup.Common/TextLocalizer.cs b/MediaBrowser.Server.Startup.Common/TextLocalizer.cs new file mode 100644 index 000000000..c578199a0 --- /dev/null +++ b/MediaBrowser.Server.Startup.Common/TextLocalizer.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Linq; +using System.Text; +using Emby.Server.Implementations.Localization; + +namespace MediaBrowser.Server.Startup.Common +{ + 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); + } + } +} -- cgit v1.2.3