/// <summary> /// Save General.Languages.Language settings to the settings file /// </summary> /// <param name="siteNode">XML-node for General.Languages.Language settings</param> public void Save(XmlNode languageNode) { XmlNode node; if (languageNode != null) { //Name node = languageNode.OwnerDocument.CreateNode(XmlNodeType.Element, "name", ""); node.InnerText = Name; languageNode.AppendChild(node); //Default node = languageNode.OwnerDocument.CreateNode(XmlNodeType.Element, "default", ""); node.InnerText = DefaultLanguage.ToString(); languageNode.AppendChild(node); // Decimal separator node = languageNode.OwnerDocument.CreateNode(XmlNodeType.Element, "decimalSeparator", ""); node.InnerText = EncodeDecimalSeparator(DecimalSeparator); languageNode.AppendChild(node); // Thousand separator node = languageNode.OwnerDocument.CreateNode(XmlNodeType.Element, "thousandSeparator", ""); node.InnerText = EncodeThousandSeparator(ThousandSeparator); languageNode.AppendChild(node); // Date format node = languageNode.OwnerDocument.CreateNode(XmlNodeType.Element, "dateFormat", ""); node.InnerText = DateFormat; languageNode.AppendChild(node); } }
/// <summary> /// Function to initialize the application. /// </summary> private static void _initialize() { Debug.Listeners.Clear(); Trace.Listeners.Clear(); StormLib.Console.Init(); Debug.Listeners.Add(new ConsoleTraceListener()); Debug.Listeners.Add(new StormLib.Diagnostics.ConsoleTraceListiner()); //Trace.Listeners.Add(new ConsoleTraceListener()); //Trace.Listeners.Add(new TortoiseConsoleTraceListiner()); mainForm = new MainForm("Tortoise Test", new Size(1280, 800), Exit); _gameLogic = new Game(mainForm); Trace.WriteLine(string.Format("Tortoise Version {0}.{1}.{2}.{3}", Program.Version.Major, Program.Version.Minor, Program.Version.Build, Program.Version.Revision)); DefaultLanguage.InitDefault(); ModuleInfo.LoadModules(Assembly.GetExecutingAssembly(), true); ServerConnection.Init(); ConsoleThread = new System.Threading.Thread(_consoleReader) { IsBackground = true }; ConsoleThread.Start(); }
private void SetDefaultLanguage() { //We check the settings first, if we have no settings for the language, then we check the system language. //If the language is not supported, then we set the language to English bool Found = false; string DefaultLanguage; if (Properties.Settings.Default.Language != "") { DefaultLanguage = Properties.Settings.Default.Language; } else { DefaultLanguage = Thread.CurrentThread.CurrentCulture.DisplayName; } foreach (SupportedLanguage Item in ListLanguage) { if (DefaultLanguage.Contains(Item.ToString())) { Found = true; SelectedLanguage = Item; } } if (!Found) { SelectedLanguage = SupportedLanguage.English; } }
/// <summary> /// Retrieving a string from resources using the UI culture of the current thread. /// By default, does not read strings from resources for the default language. /// </summary> /// <param name="prefix">Key prefix.</param> /// <param name="source">The text to be translated or the key for which we are looking for localization.</param> /// <param name="forceReadResources">If false - resources for default culture will not be read. Instead, the string /// passed as source will be returned. If source is a key and not the desired text, true must be set.</param> /// <param name="arguments">Arguments to substitute in the string format.</param> public string Get(string prefix, string source, bool forceReadResources = false, params object[] arguments) { var currentLanguage = Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName.ToLower(); if (!String.IsNullOrEmpty(source)) { string result; if (!forceReadResources && DefaultLanguage.Equals(currentLanguage, StringComparison.OrdinalIgnoreCase)) { result = source; } else { result = CachedStrings .GetOrAdd( currentLanguage, (lang) => new ConcurrentDictionary <string, string>()) .GetOrAdd( ResourceKeyGenerator.Generate(prefix, source), (key) => ResourceManager.GetString(key) ?? source); } if (arguments.Length == 0) { return(result); } return(String.Format(result, arguments)); } return(String.Empty); }
public MNReferencedCore FindContentObject(SMContentType type, string contentId) { MNReferencedCore value = null; if (CurrentLanguage != null) { value = CurrentLanguage.FindObject(contentId); } if (value == null && DefaultLanguage != null) { value = DefaultLanguage.FindObject(contentId); } if (value == null && type == SMContentType.Text) { MNReferencedText rt = FindText(contentId); if (rt != null) { MNReferencedText str = new MNReferencedText(); str.Text = rt.Text; value = str; } } return(value); }
/// <summary> /// Not more then one instance at one time /// </summary> /// <returns>Exemplar of class</returns> public static DefaultLanguage GetInstance() { if (_instance == null) { _instance = new DefaultLanguage(); } return(_instance); }
/// <summary> /// Function to initialize the application. /// </summary> private static void _initialize() { _processOSInit(); Debug.Listeners.Clear(); Trace.Listeners.Clear(); CashLib.Console.Init(); Debug.Listeners.Add(new ConsoleTraceListener()); Debug.Listeners.Add(new CashLib.Diagnostics.ConsoleTraceListiner()); //Trace.Listeners.Add(new ConsoleTraceListener()); //Trace.Listeners.Add(new TortoiseConsoleTraceListiner()); Trace.WriteLine(string.Format("CashCam Version {0}.{1}.{2}.{3}", Program.Version.Major, Program.Version.Minor, Program.Version.Build, Program.Version.Revision)); DefaultLanguage.InitDefault(); ModuleInfo.LoadModules(Assembly.GetExecutingAssembly(), true); SetupQuitFunction(); Scheduler = new CashLib.Tasks.Scheduler("CashCam Scheduler"); SchedulerThread = new CashLib.Threading.Thread("SchedulerThread"); SchedulerThread.AddTask(Scheduler); DiskThread = new CashLib.Threading.Thread("DiskThread"); DiskThread.AddTask(new DiskController()); CameraThread = new CashLib.Threading.Thread("CameraThread"); CameraManager = new CameraManager(); CameraThread.AddTask(CameraManager); WebClientThread = new CashLib.Threading.Thread("WebClientThread"); WebClientManager = new WebClientManager(); WebClientThread.AddTask(WebClientManager); WebListenThread = new CashLib.Threading.Thread("WebListenThread"); WebListenThread.AddTask(new WebServer()); //SchedulerThread.Start(); CameraThread.Start(); DiskThread.Start(); WebListenThread.Start(); WebClientThread.Start(); //ThreadsStopped += SchedulerThread.Stop; ThreadsStopped += CameraThread.Stop; ThreadsStopped += DiskThread.Stop; ThreadsStopped += WebListenThread.Stop; ThreadsStopped += WebClientThread.Stop; }
public string GetText(string id) { if (CurrentLanguage != null && CurrentLanguage.TryGetValue(id, out var text)) { return(text.Text); } if (DefaultLanguage.TryGetValue(id, out var text2)) { return(text2.Text); } throw new KeyNotFoundException("Title not found: " + id); }
private static string GetParentUICulture() { #if __WASM__ var index = DefaultLanguage.IndexOf('-'); if (index != -1) { return(DefaultLanguage.Substring(0, index)); } return(DefaultLanguage); #else return(CultureInfo.CurrentUICulture.Parent.IetfLanguageTag); #endif }
public Adminsettings() { adminSecondaryEmail = new AdminSecondaryEmail(); countryCode = new CountryCode(); creationTime = new CreationTime(); currentUsers = new CurrentUsers(); customLogo = new CustomLogo(); customerPin = new CustomerPin(); defaultLanguage = new DefaultLanguage(); emailGateway = new EmailGateway(); emailRouting = new EmailRouting(); maximumUsers = new MaximumUsers(); mxVerificationStatus = new MxVerificationStatus(); organizationName = new OrganizationName(); productVersion = new ProductVersion(); ssoSettings = new SsoSettings(); ssoSigningKey = new SsoSigningKey(); }
public MNReferencedText FindText(string styleName) { MNReferencedText s = null; if (CurrentLanguage != null) { s = CurrentLanguage.FindText(styleName); } if (s != null) { return(s); } if (DefaultLanguage != null) { s = DefaultLanguage.FindText(styleName); } return(s); }
public MNReferencedSound FindSound(string soundName) { MNReferencedSound s = null; if (CurrentLanguage != null) { s = CurrentLanguage.FindSound(soundName); } if (s != null) { return(s); } if (DefaultLanguage != null) { s = DefaultLanguage.FindSound(soundName); } return(s); }
protected AdminsettingsBase() { mainBase = new gAdminsettings(); ServiceWrapperDictionary[mainBaseType] = mainBase; adminSecondaryEmail = new AdminSecondaryEmail(); countryCode = new CountryCode(); creationTime = new CreationTime(); currentUsers = new CurrentUsers(); customLogo = new CustomLogo(); customerPin = new CustomerPin(); defaultLanguage = new DefaultLanguage(); emailGateway = new EmailGateway(); emailRouting = new EmailRouting(); maximumUsers = new MaximumUsers(); mxVerificationStatus = new MxVerificationStatus(); organizationName = new OrganizationName(); productVersion = new ProductVersion(); ssoSettings = new SsoSettings(); ssoSigningKey = new SsoSigningKey(); }
public void ReapplyStyles() { foreach (MNPage p in Data.Pages) { foreach (SMControl c in p.Objects) { MNReferencedStyle style = DefaultLanguage.FindStyle(c.StyleName); if (style != null) { c.ApplyStyle(style); } else { c.Font.Size = Math.Max(c.Font.Size, 12); } } } foreach (MNPage p in Data.Templates) { foreach (SMControl c in p.Objects) { MNReferencedStyle style = DefaultLanguage.FindStyle(c.StyleName); if (style != null) { c.ApplyStyle(style); } else { c.Font.Size = Math.Max(c.Font.Size, 12); } } } Book.Version = Math.Max(2, Book.Version); }
/// <summary> /// 将语言设置为中文 -> /// Set the language to Chinese /// </summary> public static void SetLanguageChinese() { Language = new DefaultLanguage(); }
public LanguageChecker(SpeakText speakText, DefaultLanguage defaultLanguage, TuringTranslate turingTranslate) { _speakText = speakText; _abstractLanguage = defaultLanguage; _turingTranslate = turingTranslate; }
public override void Persist(Context context) { //if (null != this.Person) this.Person.Save(context); //if (null != this.Organization) this.Organization.Save(context); //if (null != this.Security) this.Security.Save(context); if (null != this.GeographicAddressCategoryRootNode && this.GeographicAddressCategoryRootNode.NodeID == 0) { this.GeographicAddressCategoryRootNode.Save(context); } if (null != BankAccountCategoryRootNode && this.BankAccountCategoryRootNode.NodeID == 0) { BankAccountCategoryRootNode.Save(context); } if (null != BankOrgCategoryNode && this.BankOrgCategoryNode.NodeID == 0) { BankOrgCategoryNode.Save(context); } //if (null != CapitalGainTaxSchedule && CapitalGainTaxSchedule.ID == 0) CapitalGainTaxSchedule.Persist(context); if (null != ContactCategoryRootNode && ContactCategoryRootNode.NodeID == 0) { ContactCategoryRootNode.Save(context); } if (null != CountryParentNode && CountryParentNode.NodeID == 0) { CountryParentNode.Save(context); } if (null != DefaultCountry) { DefaultCountry.Save(context); } if (null != DefaultCurrency) { DefaultCurrency.Save(context); } if (null != DefaultLanguage) { DefaultLanguage.Save(context); } if (null != DefaultNationality) { DefaultNationality.Save(context); } if (null != IncomeTaxSchedule) { IncomeTaxSchedule.Persist(context); } if (null != NationalityParentNode && NationalityParentNode.NodeID == 0) { NationalityParentNode.Save(context); } if (null != GeographicAddressCategoryRootNode && GeographicAddressCategoryRootNode.NodeID == 0) { GeographicAddressCategoryRootNode.Save(context); } if (null != PartyIdentityCategoryRootNode && PartyIdentityCategoryRootNode.NodeID == 0) { PartyIdentityCategoryRootNode.Save(context); } if (null != PartyContactCategoryRootNode && PartyContactCategoryRootNode.NodeID == 0) { PartyContactCategoryRootNode.Save(context); } if (null != IdentityCategoryRootNode && IdentityCategoryRootNode.NodeID == 0) { IdentityCategoryRootNode.Save(context); } if (null != RelationshipCategoryParentNode && RelationshipCategoryParentNode.NodeID == 0) { RelationshipCategoryParentNode.Save(context); } if (null != SalesTaxSchedule && SalesTaxSchedule.ID == 0) { SalesTaxSchedule.Persist(context); } if (null != ScheduleCategoryParentNode && ScheduleCategoryParentNode.NodeID == 0) { ScheduleCategoryParentNode.Save(context); } if (null != SequenceNumberGeneratingRule && SequenceNumberGeneratingRule.ID == 0) { SequenceNumberGeneratingRule.Save(context); } if (null != SystemOwnerOrg && SystemOwnerOrg.ID == 0) { SystemOwnerOrg.Persist(context); } if (null != WorkCalendar && WorkCalendar.ID == 0) { WorkCalendar.Save(context); } if (null != NonworkCalendar && NonworkCalendar.ID == 0) { NonworkCalendar.Save(context); } if (null != TaxScheduleCategoryRootNode && TaxScheduleCategoryRootNode.NodeID == 0) { TaxScheduleCategoryRootNode.Save(context); } base.Persist(context); }
/// <summary> /// Determines whether the specified Object is equal to the current Object. /// </summary> /// <param name="obj"></param> /// <returns></returns> public override bool Equals(object obj) { if (obj == null) { return(false); } if (Object.ReferenceEquals(this, obj)) { return(true); } if (this.GetType() != obj.GetType()) { return(false); } var other = (VLSystemUser)obj; //reference types if (!Object.Equals(FirstName, other.FirstName)) { return(false); } if (!Object.Equals(LastName, other.LastName)) { return(false); } if (!Object.Equals(Email, other.Email)) { return(false); } if (!Object.Equals(TimeZoneId, other.TimeZoneId)) { return(false); } if (!Object.Equals(Notes, other.Notes)) { return(false); } //value types if (!UserId.Equals(other.UserId)) { return(false); } if (!DefaultLanguage.Equals(other.DefaultLanguage)) { return(false); } if (!IsActive.Equals(other.IsActive)) { return(false); } if (!IsBuiltIn.Equals(other.IsBuiltIn)) { return(false); } if (!AttributeFlags.Equals(other.AttributeFlags)) { return(false); } if (!Role.Equals(other.Role)) { return(false); } if (!LastActivityDate.Equals(other.LastActivityDate)) { return(false); } return(true); }
protected override void OnLoad(EventArgs e) { if (Request["Login"] == null) { Response.Redirect("CreateLogin.aspx"); } LoginLabel.Text = Request["Login"].ToUpper(); if (!Page.IsPostBack) { SqlServer server = SqlServer.CurrentServer; server.Connect(); sqlLogin = server.Logins[Request["Login"]]; if (sqlLogin == null) { Response.Redirect("CreateLogin.aspx"); } if (sqlLogin.LoginType == SqlLoginType.NTUser || sqlLogin.LoginType == SqlLoginType.NTGroup) { SecurityAccess.Enabled = true; SecurityAccessLabel.Enabled = true; if (sqlLogin.NTLoginAccessType == SqlNtAccessType.Deny) { SecurityAccess.Items[1].Selected = true; } else { SecurityAccess.Items[0].Selected = true; } } databases = server.Databases; DefaultDatabase.DataSource = databases; DefaultDatabase.DataBind(); DatabaseAccessGrid.DataSource = databases; DatabaseAccessGrid.DataBind(); // Select default database ListItem databaseItem = DefaultDatabase.Items.FindByValue(sqlLogin.Database); if (databaseItem != null) { databaseItem.Selected = true; } else { databaseItem = DefaultDatabase.Items.FindByValue("master"); if (databaseItem != null) { databaseItem.Selected = true; } } allRoles = server.Roles; ServerRoles.DataSource = allRoles; ServerRoles.DataBind(); // Select member roles foreach (ListItem item in ServerRoles.Items) { if (sqlLogin.IsMember(item.Value)) { item.Selected = true; } } DefaultLanguage.DataSource = server.Languages; DefaultLanguage.DataBind(); // Select default language ListItem languageItem = DefaultLanguage.Items.FindByValue(sqlLogin.Language); if (languageItem != null) { languageItem.Selected = true; } else { languageItem = DefaultLanguage.Items.FindByValue("English"); if (languageItem != null) { languageItem.Selected = true; } } server.Disconnect(); focusPanel(GeneralPanel); } base.OnLoad(e); }
set => Set(DefaultLanguage, value);
/// <summary> /// 将语言设置为英文 -> /// Set the language to English /// </summary> public static void SeteLanguageEnglish() { Language = new English(); }
private void ParseItemsSection(XElement itemsSection) { LocalizationDataItems = itemsSection .ItemSections() .Select( itemSection => { var KEY = itemSection.Attribute("KEY").Value() ?? itemSection.Elements("KEY").Single().Value; var VALUES = itemSection .Elements() .Where( element => element.Name != "KEY" ) .Select( element => new { ElementName = element.Name.ToString(), // ReSharper disable RedundantAnonymousTypePropertyName Value = element.Value // ReSharper restore RedundantAnonymousTypePropertyName } ) .Select( elementData => new { Language = ElementNameToLanguageMap .ValueOrDefault( elementData.ElementName ), // ReSharper disable RedundantAnonymousTypePropertyName Value = elementData.Value // ReSharper restore RedundantAnonymousTypePropertyName } ) .Where( languageData => languageData.Language != null ) .ToDictionary( languageData => languageData.Language, languageData => languageData.Value ); if (DefaultLanguage.IsNotEmpty()) { if (VALUES.ContainsKey(DefaultLanguage) == false) { VALUES.Add(DefaultLanguage, KEY); } } return(new LocalizationDataItem { Key = KEY, Values = VALUES }); } ) .ToList(); }