aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Startup.Common/TextLocalizer.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-04 22:17:18 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-04 22:17:18 -0400
commit3c1447804b5de9a7d840c7158c3cb4e0a27f76e1 (patch)
treeb7ea2715a1a9feb5e6f36c26bca09b2a32996847 /MediaBrowser.Server.Startup.Common/TextLocalizer.cs
parent25312d7d03af665818cfd2cee2edb549e0e940f2 (diff)
move localization classes
Diffstat (limited to 'MediaBrowser.Server.Startup.Common/TextLocalizer.cs')
-rw-r--r--MediaBrowser.Server.Startup.Common/TextLocalizer.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Startup.Common/TextLocalizer.cs b/MediaBrowser.Server.Startup.Common/TextLocalizer.cs
new file mode 100644
index 0000000000..c578199a07
--- /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);
+ }
+ }
+}