2015-01-17 20:12:02 +00:00
|
|
|
|
using MediaBrowser.Model.Extensions;
|
2013-10-31 14:03:23 +00:00
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
2013-06-06 14:33:11 +00:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
|
using MediaBrowser.Model.Globalization;
|
2014-03-31 01:00:47 +00:00
|
|
|
|
using MediaBrowser.Model.Serialization;
|
2013-06-10 17:46:11 +00:00
|
|
|
|
using System;
|
2013-06-11 02:34:55 +00:00
|
|
|
|
using System.Collections.Concurrent;
|
2013-06-06 14:33:11 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Globalization;
|
2013-06-10 17:46:11 +00:00
|
|
|
|
using System.IO;
|
2013-06-06 14:33:11 +00:00
|
|
|
|
using System.Linq;
|
2016-10-25 19:02:04 +00:00
|
|
|
|
using MediaBrowser.Model.IO;
|
2016-06-30 23:17:49 +00:00
|
|
|
|
using MediaBrowser.Model.Logging;
|
2016-11-05 02:17:18 +00:00
|
|
|
|
using MediaBrowser.Model.Reflection;
|
2013-06-06 14:33:11 +00:00
|
|
|
|
|
2016-11-05 02:17:18 +00:00
|
|
|
|
namespace Emby.Server.Implementations.Localization
|
2013-06-06 14:33:11 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class LocalizationManager
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class LocalizationManager : ILocalizationManager
|
|
|
|
|
{
|
2013-06-10 17:46:11 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The _configuration manager
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly IServerConfigurationManager _configurationManager;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The us culture
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
|
|
|
|
|
2013-06-11 02:34:55 +00:00
|
|
|
|
private readonly ConcurrentDictionary<string, Dictionary<string, ParentalRating>> _allParentalRatings =
|
|
|
|
|
new ConcurrentDictionary<string, Dictionary<string, ParentalRating>>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
2013-10-31 14:03:23 +00:00
|
|
|
|
private readonly IFileSystem _fileSystem;
|
2014-03-31 01:00:47 +00:00
|
|
|
|
private readonly IJsonSerializer _jsonSerializer;
|
2016-06-30 23:17:49 +00:00
|
|
|
|
private readonly ILogger _logger;
|
2016-11-05 02:17:18 +00:00
|
|
|
|
private readonly IAssemblyInfo _assemblyInfo;
|
|
|
|
|
private readonly ITextLocalizer _textLocalizer;
|
2014-03-31 01:00:47 +00:00
|
|
|
|
|
2013-06-10 17:46:11 +00:00
|
|
|
|
/// <summary>
|
2014-06-05 02:32:40 +00:00
|
|
|
|
/// Initializes a new instance of the <see cref="LocalizationManager" /> class.
|
2013-06-10 17:46:11 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="configurationManager">The configuration manager.</param>
|
2014-06-05 02:32:40 +00:00
|
|
|
|
/// <param name="fileSystem">The file system.</param>
|
|
|
|
|
/// <param name="jsonSerializer">The json serializer.</param>
|
2016-11-05 02:17:18 +00:00
|
|
|
|
public LocalizationManager(IServerConfigurationManager configurationManager, IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, IAssemblyInfo assemblyInfo, ITextLocalizer textLocalizer)
|
2013-06-10 17:46:11 +00:00
|
|
|
|
{
|
|
|
|
|
_configurationManager = configurationManager;
|
2013-10-31 14:03:23 +00:00
|
|
|
|
_fileSystem = fileSystem;
|
2014-03-31 01:00:47 +00:00
|
|
|
|
_jsonSerializer = jsonSerializer;
|
2016-06-30 23:17:49 +00:00
|
|
|
|
_logger = logger;
|
2016-11-05 02:17:18 +00:00
|
|
|
|
_assemblyInfo = assemblyInfo;
|
|
|
|
|
_textLocalizer = textLocalizer;
|
2013-06-18 20:54:32 +00:00
|
|
|
|
|
|
|
|
|
ExtractAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ExtractAll()
|
|
|
|
|
{
|
|
|
|
|
var type = GetType();
|
|
|
|
|
var resourcePath = type.Namespace + ".Ratings.";
|
|
|
|
|
|
|
|
|
|
var localizationPath = LocalizationPath;
|
|
|
|
|
|
2015-09-13 21:32:02 +00:00
|
|
|
|
_fileSystem.CreateDirectory(localizationPath);
|
2013-06-18 20:54:32 +00:00
|
|
|
|
|
2016-11-05 02:17:18 +00:00
|
|
|
|
var existingFiles = GetRatingsFiles(localizationPath)
|
2013-06-21 13:42:27 +00:00
|
|
|
|
.Select(Path.GetFileName)
|
|
|
|
|
.ToList();
|
|
|
|
|
|
2013-06-18 20:54:32 +00:00
|
|
|
|
// Extract from the assembly
|
2016-11-05 02:17:18 +00:00
|
|
|
|
foreach (var resource in _assemblyInfo
|
|
|
|
|
.GetManifestResourceNames(type)
|
2013-06-18 20:54:32 +00:00
|
|
|
|
.Where(i => i.StartsWith(resourcePath)))
|
|
|
|
|
{
|
|
|
|
|
var filename = "ratings-" + resource.Substring(resourcePath.Length);
|
|
|
|
|
|
|
|
|
|
if (!existingFiles.Contains(filename))
|
|
|
|
|
{
|
2016-11-05 02:17:18 +00:00
|
|
|
|
using (var stream = _assemblyInfo.GetManifestResourceStream(type, resource))
|
2013-06-18 20:54:32 +00:00
|
|
|
|
{
|
2016-06-30 23:17:49 +00:00
|
|
|
|
var target = Path.Combine(localizationPath, filename);
|
|
|
|
|
_logger.Info("Extracting ratings to {0}", target);
|
|
|
|
|
|
2016-10-25 19:02:04 +00:00
|
|
|
|
using (var fs = _fileSystem.GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
2013-06-18 20:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
stream.CopyTo(fs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-05 02:17:18 +00:00
|
|
|
|
|
|
|
|
|
foreach (var file in GetRatingsFiles(localizationPath))
|
2013-06-18 20:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
LoadRatings(file);
|
|
|
|
|
}
|
2013-06-10 17:46:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-05 02:17:18 +00:00
|
|
|
|
private List<string> GetRatingsFiles(string directory)
|
|
|
|
|
{
|
|
|
|
|
return _fileSystem.GetFilePaths(directory, false)
|
|
|
|
|
.Where(i => string.Equals(Path.GetExtension(i), ".txt", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.Where(i => Path.GetFileName(i).StartsWith("ratings-", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.ToList();
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-10 17:46:11 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the localization path.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The localization path.</value>
|
|
|
|
|
public string LocalizationPath
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Path.Combine(_configurationManager.ApplicationPaths.ProgramDataPath, "localization");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-25 19:02:04 +00:00
|
|
|
|
public string RemoveDiacritics(string text)
|
|
|
|
|
{
|
2016-11-05 02:17:18 +00:00
|
|
|
|
return _textLocalizer.RemoveDiacritics(text);
|
2016-10-25 19:02:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-27 07:58:33 +00:00
|
|
|
|
public string NormalizeFormKD(string text)
|
|
|
|
|
{
|
2016-11-05 02:17:18 +00:00
|
|
|
|
return _textLocalizer.NormalizeFormKD(text);
|
2016-10-27 07:58:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-06 14:33:11 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the cultures.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>IEnumerable{CultureDto}.</returns>
|
2017-08-19 19:43:35 +00:00
|
|
|
|
public CultureDto[] GetCultures()
|
2013-06-06 14:33:11 +00:00
|
|
|
|
{
|
2014-05-07 02:28:19 +00:00
|
|
|
|
var type = GetType();
|
2014-06-18 15:12:20 +00:00
|
|
|
|
var path = type.Namespace + ".iso6392.txt";
|
|
|
|
|
|
|
|
|
|
var list = new List<CultureDto>();
|
2014-05-07 02:28:19 +00:00
|
|
|
|
|
2016-11-05 02:17:18 +00:00
|
|
|
|
using (var stream = _assemblyInfo.GetManifestResourceStream(type, path))
|
2014-05-07 02:28:19 +00:00
|
|
|
|
{
|
2014-06-18 15:12:20 +00:00
|
|
|
|
using (var reader = new StreamReader(stream))
|
|
|
|
|
{
|
|
|
|
|
while (!reader.EndOfStream)
|
|
|
|
|
{
|
|
|
|
|
var line = reader.ReadLine();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(line))
|
|
|
|
|
{
|
|
|
|
|
var parts = line.Split('|');
|
|
|
|
|
|
|
|
|
|
if (parts.Length == 5)
|
|
|
|
|
{
|
|
|
|
|
list.Add(new CultureDto
|
|
|
|
|
{
|
|
|
|
|
DisplayName = parts[3],
|
|
|
|
|
Name = parts[3],
|
|
|
|
|
ThreeLetterISOLanguageName = parts[0],
|
|
|
|
|
TwoLetterISOLanguageName = parts[2]
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-07 02:28:19 +00:00
|
|
|
|
}
|
2014-06-18 15:12:20 +00:00
|
|
|
|
|
|
|
|
|
return list.Where(i => !string.IsNullOrWhiteSpace(i.Name) &&
|
|
|
|
|
!string.IsNullOrWhiteSpace(i.DisplayName) &&
|
|
|
|
|
!string.IsNullOrWhiteSpace(i.ThreeLetterISOLanguageName) &&
|
2017-08-19 19:43:35 +00:00
|
|
|
|
!string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToArray();
|
2013-06-06 14:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the countries.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>IEnumerable{CountryInfo}.</returns>
|
2017-08-19 19:43:35 +00:00
|
|
|
|
public CountryInfo[] GetCountries()
|
2013-06-06 14:33:11 +00:00
|
|
|
|
{
|
2014-05-07 02:28:19 +00:00
|
|
|
|
var type = GetType();
|
|
|
|
|
var path = type.Namespace + ".countries.json";
|
|
|
|
|
|
2016-11-05 02:17:18 +00:00
|
|
|
|
using (var stream = _assemblyInfo.GetManifestResourceStream(type, path))
|
2014-05-07 02:28:19 +00:00
|
|
|
|
{
|
2017-08-19 19:43:35 +00:00
|
|
|
|
return _jsonSerializer.DeserializeFromStream<CountryInfo[]>(stream);
|
2014-05-07 02:28:19 +00:00
|
|
|
|
}
|
2013-06-06 14:33:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the parental ratings.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>IEnumerable{ParentalRating}.</returns>
|
2017-08-19 19:43:35 +00:00
|
|
|
|
public ParentalRating[] GetParentalRatings()
|
2013-06-06 14:33:11 +00:00
|
|
|
|
{
|
2017-08-19 19:43:35 +00:00
|
|
|
|
return GetParentalRatingsDictionary().Values.ToArray();
|
2013-06-11 02:34:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the parental ratings dictionary.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>Dictionary{System.StringParentalRating}.</returns>
|
|
|
|
|
private Dictionary<string, ParentalRating> GetParentalRatingsDictionary()
|
|
|
|
|
{
|
|
|
|
|
var countryCode = _configurationManager.Configuration.MetadataCountryCode;
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(countryCode))
|
|
|
|
|
{
|
|
|
|
|
countryCode = "us";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ratings = GetRatings(countryCode);
|
|
|
|
|
|
|
|
|
|
if (ratings == null)
|
|
|
|
|
{
|
|
|
|
|
ratings = GetRatings("us");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ratings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the ratings.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="countryCode">The country code.</param>
|
|
|
|
|
private Dictionary<string, ParentalRating> GetRatings(string countryCode)
|
|
|
|
|
{
|
|
|
|
|
Dictionary<string, ParentalRating> value;
|
|
|
|
|
|
2013-06-18 20:54:32 +00:00
|
|
|
|
_allParentalRatings.TryGetValue(countryCode, out value);
|
2013-06-11 02:34:55 +00:00
|
|
|
|
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Loads the ratings.
|
|
|
|
|
/// </summary>
|
2013-06-18 20:54:32 +00:00
|
|
|
|
/// <param name="file">The file.</param>
|
|
|
|
|
/// <returns>Dictionary{System.StringParentalRating}.</returns>
|
|
|
|
|
private void LoadRatings(string file)
|
2013-06-11 02:34:55 +00:00
|
|
|
|
{
|
2016-11-05 02:17:18 +00:00
|
|
|
|
var dict = _fileSystem.ReadAllLines(file).Select(i =>
|
2013-06-10 17:46:11 +00:00
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(i))
|
|
|
|
|
{
|
|
|
|
|
var parts = i.Split(',');
|
|
|
|
|
|
|
|
|
|
if (parts.Length == 2)
|
|
|
|
|
{
|
|
|
|
|
int value;
|
|
|
|
|
|
|
|
|
|
if (int.TryParse(parts[1], NumberStyles.Integer, UsCulture, out value))
|
|
|
|
|
{
|
|
|
|
|
return new ParentalRating { Name = parts[0], Value = value };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
.Where(i => i != null)
|
2013-09-11 17:55:12 +00:00
|
|
|
|
.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
|
2013-06-10 17:46:11 +00:00
|
|
|
|
|
2014-07-26 17:30:15 +00:00
|
|
|
|
var countryCode = _fileSystem.GetFileNameWithoutExtension(file)
|
|
|
|
|
.Split('-')
|
|
|
|
|
.Last();
|
2013-06-10 17:46:11 +00:00
|
|
|
|
|
2013-06-18 20:54:32 +00:00
|
|
|
|
_allParentalRatings.TryAdd(countryCode, dict);
|
2013-06-10 17:46:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-11-06 15:02:22 +00:00
|
|
|
|
private readonly string[] _unratedValues = {"n/a", "unrated", "not rated"};
|
|
|
|
|
|
2013-06-10 17:46:11 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the rating level.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int? GetRatingLevel(string rating)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(rating))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException("rating");
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-06 15:02:22 +00:00
|
|
|
|
if (_unratedValues.Contains(rating, StringComparer.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-11 16:32:15 +00:00
|
|
|
|
// Fairly common for some users to have "Rated R" in their rating field
|
|
|
|
|
rating = rating.Replace("Rated ", string.Empty, StringComparison.OrdinalIgnoreCase);
|
|
|
|
|
|
2013-06-11 02:34:55 +00:00
|
|
|
|
var ratingsDictionary = GetParentalRatingsDictionary();
|
2013-06-10 17:46:11 +00:00
|
|
|
|
|
2013-06-11 02:34:55 +00:00
|
|
|
|
ParentalRating value;
|
2013-06-10 17:46:11 +00:00
|
|
|
|
|
2013-06-11 02:34:55 +00:00
|
|
|
|
if (!ratingsDictionary.TryGetValue(rating, out value))
|
|
|
|
|
{
|
2013-06-18 20:54:32 +00:00
|
|
|
|
// If we don't find anything check all ratings systems
|
|
|
|
|
foreach (var dictionary in _allParentalRatings.Values)
|
|
|
|
|
{
|
|
|
|
|
if (dictionary.TryGetValue(rating, out value))
|
|
|
|
|
{
|
|
|
|
|
return value.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-06-11 02:34:55 +00:00
|
|
|
|
}
|
2013-06-10 17:46:11 +00:00
|
|
|
|
|
2013-06-11 02:34:55 +00:00
|
|
|
|
return value == null ? (int?)null : value.Value;
|
2013-06-10 17:46:11 +00:00
|
|
|
|
}
|
2014-03-31 01:00:47 +00:00
|
|
|
|
|
|
|
|
|
public string GetLocalizedString(string phrase)
|
|
|
|
|
{
|
|
|
|
|
return GetLocalizedString(phrase, _configurationManager.Configuration.UICulture);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetLocalizedString(string phrase, string culture)
|
|
|
|
|
{
|
|
|
|
|
var dictionary = GetLocalizationDictionary(culture);
|
|
|
|
|
|
|
|
|
|
string value;
|
|
|
|
|
|
|
|
|
|
if (dictionary.TryGetValue(phrase, out value))
|
|
|
|
|
{
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return phrase;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly ConcurrentDictionary<string, Dictionary<string, string>> _dictionaries =
|
|
|
|
|
new ConcurrentDictionary<string, Dictionary<string, string>>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
|
|
public Dictionary<string, string> GetLocalizationDictionary(string culture)
|
|
|
|
|
{
|
2015-07-27 18:18:10 +00:00
|
|
|
|
const string prefix = "Core";
|
2014-03-31 01:00:47 +00:00
|
|
|
|
var key = prefix + culture;
|
|
|
|
|
|
2015-07-27 18:18:10 +00:00
|
|
|
|
return _dictionaries.GetOrAdd(key, k => GetDictionary(prefix, culture, "core.json"));
|
2014-03-31 01:00:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Dictionary<string, string> GetDictionary(string prefix, string culture, string baseFilename)
|
|
|
|
|
{
|
|
|
|
|
var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
|
|
var namespaceName = GetType().Namespace + "." + prefix;
|
|
|
|
|
|
2016-11-05 02:17:18 +00:00
|
|
|
|
CopyInto(dictionary, namespaceName + "." + baseFilename);
|
|
|
|
|
CopyInto(dictionary, namespaceName + "." + GetResourceFilename(culture));
|
2014-03-31 01:00:47 +00:00
|
|
|
|
|
|
|
|
|
return dictionary;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-05 02:17:18 +00:00
|
|
|
|
private void CopyInto(IDictionary<string, string> dictionary, string resourcePath)
|
2014-03-31 01:00:47 +00:00
|
|
|
|
{
|
2016-11-05 02:17:18 +00:00
|
|
|
|
using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), resourcePath))
|
2014-03-31 01:00:47 +00:00
|
|
|
|
{
|
|
|
|
|
if (stream != null)
|
|
|
|
|
{
|
|
|
|
|
var dict = _jsonSerializer.DeserializeFromStream<Dictionary<string, string>>(stream);
|
|
|
|
|
|
|
|
|
|
foreach (var key in dict.Keys)
|
|
|
|
|
{
|
|
|
|
|
dictionary[key] = dict[key];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetResourceFilename(string culture)
|
|
|
|
|
{
|
|
|
|
|
var parts = culture.Split('-');
|
|
|
|
|
|
|
|
|
|
if (parts.Length == 2)
|
|
|
|
|
{
|
2015-05-22 15:59:17 +00:00
|
|
|
|
culture = parts[0].ToLower() + "-" + parts[1].ToUpper();
|
2014-03-31 01:00:47 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
culture = culture.ToLower();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return culture + ".json";
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-19 19:43:35 +00:00
|
|
|
|
public LocalizatonOption[] GetLocalizationOptions()
|
2014-03-31 01:00:47 +00:00
|
|
|
|
{
|
2017-08-19 19:43:35 +00:00
|
|
|
|
return new LocalizatonOption[]
|
2014-03-31 01:00:47 +00:00
|
|
|
|
{
|
2014-04-05 15:02:50 +00:00
|
|
|
|
new LocalizatonOption{ Name="Arabic", Value="ar"},
|
2015-01-22 17:41:16 +00:00
|
|
|
|
new LocalizatonOption{ Name="Bulgarian (Bulgaria)", Value="bg-BG"},
|
2014-04-09 02:12:17 +00:00
|
|
|
|
new LocalizatonOption{ Name="Catalan", Value="ca"},
|
2014-10-20 03:04:45 +00:00
|
|
|
|
new LocalizatonOption{ Name="Chinese Simplified", Value="zh-CN"},
|
2014-03-31 21:04:22 +00:00
|
|
|
|
new LocalizatonOption{ Name="Chinese Traditional", Value="zh-TW"},
|
2014-09-26 03:47:46 +00:00
|
|
|
|
new LocalizatonOption{ Name="Croatian", Value="hr"},
|
2014-04-09 02:12:17 +00:00
|
|
|
|
new LocalizatonOption{ Name="Czech", Value="cs"},
|
2014-05-09 19:43:06 +00:00
|
|
|
|
new LocalizatonOption{ Name="Danish", Value="da"},
|
2014-03-31 21:04:22 +00:00
|
|
|
|
new LocalizatonOption{ Name="Dutch", Value="nl"},
|
2015-01-22 17:41:16 +00:00
|
|
|
|
new LocalizatonOption{ Name="English (United Kingdom)", Value="en-GB"},
|
|
|
|
|
new LocalizatonOption{ Name="English (United States)", Value="en-us"},
|
2014-11-04 12:41:12 +00:00
|
|
|
|
new LocalizatonOption{ Name="Finnish", Value="fi"},
|
2014-03-31 21:04:22 +00:00
|
|
|
|
new LocalizatonOption{ Name="French", Value="fr"},
|
2016-03-17 17:27:17 +00:00
|
|
|
|
new LocalizatonOption{ Name="French (Canada)", Value="fr-CA"},
|
2014-03-31 02:33:10 +00:00
|
|
|
|
new LocalizatonOption{ Name="German", Value="de"},
|
2014-04-05 15:02:50 +00:00
|
|
|
|
new LocalizatonOption{ Name="Greek", Value="el"},
|
2014-04-01 22:23:07 +00:00
|
|
|
|
new LocalizatonOption{ Name="Hebrew", Value="he"},
|
2015-03-08 18:21:39 +00:00
|
|
|
|
new LocalizatonOption{ Name="Hungarian", Value="hu"},
|
2016-01-06 16:46:39 +00:00
|
|
|
|
new LocalizatonOption{ Name="Indonesian", Value="id"},
|
2014-04-01 22:23:07 +00:00
|
|
|
|
new LocalizatonOption{ Name="Italian", Value="it"},
|
2014-04-18 17:16:25 +00:00
|
|
|
|
new LocalizatonOption{ Name="Kazakh", Value="kk"},
|
2014-04-04 03:36:05 +00:00
|
|
|
|
new LocalizatonOption{ Name="Norwegian Bokmål", Value="nb"},
|
2017-03-14 19:55:54 +00:00
|
|
|
|
new LocalizatonOption{ Name="Persian", Value="fa"},
|
2014-06-29 19:59:52 +00:00
|
|
|
|
new LocalizatonOption{ Name="Polish", Value="pl"},
|
2014-03-31 21:04:22 +00:00
|
|
|
|
new LocalizatonOption{ Name="Portuguese (Brazil)", Value="pt-BR"},
|
2014-03-31 02:33:10 +00:00
|
|
|
|
new LocalizatonOption{ Name="Portuguese (Portugal)", Value="pt-PT"},
|
2014-03-31 21:04:22 +00:00
|
|
|
|
new LocalizatonOption{ Name="Russian", Value="ru"},
|
2015-02-05 21:14:08 +00:00
|
|
|
|
new LocalizatonOption{ Name="Slovenian (Slovenia)", Value="sl-SI"},
|
2014-07-09 00:46:11 +00:00
|
|
|
|
new LocalizatonOption{ Name="Spanish", Value="es-ES"},
|
2014-04-08 04:17:18 +00:00
|
|
|
|
new LocalizatonOption{ Name="Spanish (Mexico)", Value="es-MX"},
|
2014-06-07 19:46:24 +00:00
|
|
|
|
new LocalizatonOption{ Name="Swedish", Value="sv"},
|
2014-08-01 00:37:06 +00:00
|
|
|
|
new LocalizatonOption{ Name="Turkish", Value="tr"},
|
2015-01-22 17:41:16 +00:00
|
|
|
|
new LocalizatonOption{ Name="Ukrainian", Value="uk"},
|
2014-06-07 19:46:24 +00:00
|
|
|
|
new LocalizatonOption{ Name="Vietnamese", Value="vi"}
|
2014-03-31 02:33:10 +00:00
|
|
|
|
|
2017-08-19 19:43:35 +00:00
|
|
|
|
};
|
2014-03-31 01:00:47 +00:00
|
|
|
|
}
|
2013-06-06 14:33:11 +00:00
|
|
|
|
}
|
2016-11-05 02:17:18 +00:00
|
|
|
|
|
|
|
|
|
public interface ITextLocalizer
|
|
|
|
|
{
|
|
|
|
|
string RemoveDiacritics(string text);
|
|
|
|
|
|
|
|
|
|
string NormalizeFormKD(string text);
|
|
|
|
|
}
|
2013-06-06 14:33:11 +00:00
|
|
|
|
}
|