diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-11-05 15:36:32 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-05 15:36:32 -0400 |
| commit | 36c01cfc7649b95c7ff63833424f1952e7889d07 (patch) | |
| tree | be560399d41766ff4ef6e49dd90c488e88838488 /MediaBrowser.Server.Startup.Common/TextLocalizer.cs | |
| parent | 398398f3018434de7c057dffccb6c0373ff97526 (diff) | |
| parent | a4832369bf3abe7afbc2a35faa991be1ace64494 (diff) | |
Merge pull request #2274 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Server.Startup.Common/TextLocalizer.cs')
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/TextLocalizer.cs | 25 |
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); + } + } +} |
