using System.Globalization;
namespace Abp.Localization
{
///
/// Represents an available language for the application.
///
public class LanguageInfo
{
///
/// Code name of the language.
/// It should be valid culture code.
/// Ex: "en-US" for American English, "tr-TR" for Turkey Turkish.
///
public string Name { get; set; }
///
/// Display name of the language in it's original language.
/// Ex: "English" for English, "Türkçe" for Turkish.
///
public string DisplayName { get; set; }
///
/// An icon can be set to display on the UI.
///
public string Icon { get; set; }
///
/// Is this the default language?
///
public bool IsDefault { get; set; }
///
/// Is this the language disabled?
///
public bool IsDisabled { get; set; }
///
/// Is this language Right To Left?
///
public bool IsRightToLeft
{
get
{
try
{
return CultureInfo.GetCultureInfo(Name).TextInfo?.IsRightToLeft ?? false;
}
catch
{
return false;
}
}
}
///
/// Creates a new object.
///
///
/// Code name of the language.
/// It should be valid culture code.
/// Ex: "en-US" for American English, "tr-TR" for Turkey Turkish.
///
///
/// Display name of the language in it's original language.
/// Ex: "English" for English, "Türkçe" for Turkish.
///
/// An icon can be set to display on the UI
/// Is this the default language?
/// Is this the language disabled?
public LanguageInfo(string name, string displayName, string icon = null, bool isDefault = false, bool isDisabled = false)
{
Name = name;
DisplayName = displayName;
Icon = icon;
IsDefault = isDefault;
IsDisabled = isDisabled;
}
}
}