aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Startup.Common/TextLocalizer.cs
diff options
context:
space:
mode:
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 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);
+ }
+ }
+}