#region S# License
/******************************************************************************************
NOTICE!!! This program and source code is owned and licensed by
StockSharp, LLC, www.stocksharp.com
Viewing or use of this code requires your acceptance of the license
agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
Removal of this comment is a violation of the license agreement.
Project: StockSharp.Localization.Localization
File: LocalizedStrings.cs
Created: 2015, 11, 11, 2:32 PM
Copyright 2010 by StockSharp, LLC
*******************************************************************************************/
#endregion S# License
namespace StockSharp.Localization
{
using System;
using System.Globalization;
using Ecng.Common;
using Ecng.Localization;
///
/// Localized strings.
///
public static partial class LocalizedStrings
{
static LocalizedStrings()
{
var activeLang = CultureInfo.CurrentCulture.Name.CompareIgnoreCase(LocalizationHelper.Ru)
? Languages.Russian
: Languages.English;
LocalizationHelper.DefaultManager = new LocalizationManager(typeof(LocalizedStrings).Assembly, "text.csv") { ActiveLanguage = activeLang };
}
private static LocalizationManager Manager => LocalizationHelper.DefaultManager;
///
/// Error handler to track missed translations or resource keys.
///
public static event Action Missing
{
add { Manager.Missing += value; }
remove { Manager.Missing -= value; }
}
///
/// Current language.
///
public static Languages ActiveLanguage
{
get { return Manager.ActiveLanguage; }
set { Manager.ActiveLanguage = value; }
}
///
/// Get localized string.
///
/// Resource unique key.
/// Language.
/// Localized string.
public static string GetString(string resourceId, Languages? language = null)
{
return Manager.GetString(resourceId, language);
}
///
/// Web site domain.
///
public static string Domain => ActiveLanguage == Languages.Russian ? "ru" : "com";
}
}