本文整理汇总了C#中Locale.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Locale.ToString方法的具体用法?C# Locale.ToString怎么用?C# Locale.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locale
的用法示例。
在下文中一共展示了Locale.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetResourceLiteral
/// <summary>
///
/// </summary>
/// <param name="key">
/// A <see cref="System.String"/>
/// </param>
/// <param name="locale">
/// A <see cref="Locale"/>
/// </param>
/// <returns>
/// A <see cref="System.String"/>
/// </returns>
public string GetResourceLiteral(string key, Locale locale)
{
if (locale == null) {
return GetResourceLiteral (key);
} else {
return GetResourceLiteral (key, locale.ToString ());
}
}
示例2: GetResourceLiterals
/// <summary>
///
/// </summary>
/// <param name="locale">
/// A <see cref="Locale"/>
/// </param>
/// <returns>
/// A <see cref="Unity.Core.I18N.ResourceLiteralDictionary"/>
/// </returns>
public ResourceLiteralDictionary GetResourceLiterals(Locale locale)
{
if (locale == null) {
return GetResourceLiterals ();
} else {
return GetResourceLiterals (locale.ToString ());
}
}
示例3: GetResourceLiteral
public override async Task<string> GetResourceLiteral(string key, Locale locale)
{
if (String.IsNullOrWhiteSpace(key)) return String.Empty;
key = key.ToUpper();
var sLocaleName = (locale == null) ? _i18NConfiguration.DefaultLanguage.Language.ToLower() : locale.ToString().ToLower();
sLocaleName = (sLocaleName.StartsWith("-")) ? sLocaleName.Remove(0, 1) : sLocaleName;
sLocaleName = (sLocaleName.EndsWith("-")) ? sLocaleName.Remove(sLocaleName.Length - 1, 1) : sLocaleName;
if (_languageFilesDictionary.ContainsKey(sLocaleName) && _languageFilesDictionary[sLocaleName].ContainsKey(key))
{
return _languageFilesDictionary[sLocaleName][key];
}
var sNewLocalName = (!String.IsNullOrWhiteSpace(locale.Language)) ? locale.Language.ToLower() : String.Empty;
if (!sNewLocalName.Equals(sLocaleName) && !String.IsNullOrWhiteSpace(sNewLocalName))
{
if (_languageFilesDictionary.ContainsKey(sLocaleName) && _languageFilesDictionary[sLocaleName].ContainsKey(key))
{
return _languageFilesDictionary[sLocaleName][key];
}
}
sNewLocalName = (!String.IsNullOrWhiteSpace(locale.Country)) ? locale.Country.ToLower() : String.Empty;
if (sNewLocalName.Equals(sLocaleName) || String.IsNullOrWhiteSpace(sNewLocalName)) return String.Empty;
if (_languageFilesDictionary.ContainsKey(sLocaleName) && _languageFilesDictionary[sLocaleName].ContainsKey(key))
{
return _languageFilesDictionary[sLocaleName][key];
}
return String.Empty;
}