public void SynchronizeLanguageToCulture() { if (CurrentLanguage == null || !CurrentLanguage.Equals(Thread.CurrentThread.CurrentUICulture.Name)) { SetLanguage(Thread.CurrentThread.CurrentUICulture.Name); } }
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> /// Updates the <see cref="BaseUbiIniGameConfigViewModel{Handler}.ConfigData"/> /// </summary> /// <returns>The task</returns> protected override Task UpdateConfigAsync() { ConfigData.GLI_Mode = new RayGLI_Mode() { ColorMode = IsTextures32Bit ? 32 : 16, IsWindowed = !FullscreenMode, ResX = ResX, ResY = ResY }.ToString(); ConfigData.FormattedTriLinear = TriLinear; ConfigData.FormattedTnL = TnL; ConfigData.FormattedTexturesCompressed = CompressedTextures; ConfigData.Video_WantedQuality = VideoQuality.ToString(); ConfigData.FormattedVideo_AutoAdjustQuality = AutoVideoQuality; ConfigData.Video_BPP = IsVideo32Bpp ? "32" : "16"; ConfigData.Language = CurrentLanguage.ToString(); ConfigData.FormattedDynamicShadows = DynamicShadows; ConfigData.FormattedStaticShadows = StaticShadows; ConfigData.Camera_VerticalAxis = VerticalAxis.ToString(); ConfigData.Camera_HorizontalAxis = HorizontalAxis.ToString(); ConfigData.TexturesFile = $"Tex{(IsTextures32Bit ? 32 : 16)}.cnt"; return(Task.CompletedTask); }
/// <summary> /// Returns a string /// </summary> /// <param name="id">ID of the string</param> /// <returns>The string or string.Empty if not found</returns> public string GetString(int id) { if (CurrentLanguage == null) { // Try default language CurrentLanguage = GetLanguage(Default); if (CurrentLanguage == null) { return(string.Empty); } } string str = string.Empty; try { // First try to find in the current language str = CurrentLanguage.GetString(id); } catch (KeyNotFoundException) { // If not found, try to find in the default language try { str = Languages[Default].GetString(id); } catch (KeyNotFoundException) { // Oops, not found at all !! return(string.Empty); } } return(str); }
public Welcome() { InitializeComponent(); DB = new DB(); CurrentLanguage.SetLanguage((TorunLanguage)Properties.Settings.Default.set_language); // set language from user settings Lang = CurrentLanguage.Language; }
public static void RemoveLanguage(string name) { string path = Path.Combine(LESettings.VisualLocFilePath, name + LEConstants.VisualFileExtension); string logicalPath = Path.Combine(LESettings.LogicalLocFilePath, name + LEConstants.LogicalFileExtension); // Delete the language file File.Delete(path); File.Delete(logicalPath); // Remove the language from the collection AllLangsVisual.Remove(name); AllLangsLogical.Remove(name); // If the deleted language is currently selected, unset it if (CurrentLanguage.Equals(name)) { CurrentLanguage = string.Empty; } if (AllLangsLogical.Count == 0) { MasterKeys.Clear(); } NeedsSave = true; }
/// <summary> /// Sets the value of a string /// </summary> /// <param name="id">ID of the string</param> /// <param name="message">Value of the message</param> public void SetString(int id, string message) { if (CurrentLanguage == null) { return; } CurrentLanguage.SetString(id, message); }
/// <summary> /// Adds a string to the current language /// </summary> /// <param name="message"></param> /// <returns></returns> public int AddString(string message) { if (CurrentLanguage == null) { return(-1); } return(CurrentLanguage.AddString(message)); }
/// <summary> /// Opens the reset dialog /// </summary> /// <param name="itemId"></param> public void ResetSubItem(string itemId) { var resetDialog = new UrlString(UIUtil.GetUri("control:ResetFields")); resetDialog.Add("id", itemId); resetDialog.Add("la", CurrentLanguage.ToString()); resetDialog.Add("vs", ItemVersion); SheerResponse.ShowModalDialog(resetDialog.ToString(), false); }
public void LocalUpdate(string pluginPath, string language) { if (CurrentLanguage.Equals(language, StringComparison.InvariantCultureIgnoreCase)) { Logger.Write($"Local data already updated for language {language}", LogLevel.Debug); return; } OnLocalUpdatedRequested(pluginPath, language); }
private void LoadText_Click(object sender, RoutedEventArgs e) { var openDialog = new Microsoft.Win32.OpenFileDialog(); if (openDialog.ShowDialog() == true) { CurrentLanguage.LoadText(openDialog.FileName); //string loadedText = File.ReadAllText(openDialog.FileName, Encoding.UTF8); //UpdateTextView(loadedText, ViewMode.Text); } }
public static string GetText(string key) { if (CurrentLanguage.ContainsKey(key)) { return(CurrentLanguage[key]); } else { return("[" + key + "]"); } }
protected override void OnCurrentLanguageChanged() { base.OnCurrentLanguageChanged(); Text = CurrentLanguage["Icon Library"]; BtnClose.Text = CurrentLanguage.GetTextWithAccelerator("Close", 'C'); TsbAddFiles.Text = CurrentLanguage["Add Image Files"]; TsbAddFromInternet.Text = CurrentLanguage["Download Image From Internet"]; TsbRefresh.Text = CurrentLanguage["Refresh"]; TsbDelete.Text = CurrentLanguage["Delete"]; TsbResize.Text = CurrentLanguage["Resize"]; }
public static void SetLanguage(string languageDisplayName) { if ((CurrentLanguage == null) || (CurrentLanguage.DisplayName != languageDisplayName)) { AppLanguage language = null; if (__languages.TryGetValue(languageDisplayName, out language)) { CurrentLanguage.Assign(language); LanguageSelectedMessage.Send(); } } }
private static string GetTranslation(string key) { if (string.IsNullOrWhiteSpace(key)) { return(key); } key = key.Trim(); if (!CurrentLanguage.ContainsKey(key)) { return(key); } return(CurrentLanguage[key]); }
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); }
void Localize() { TextTab = new Hashtable(); XDocument doc = XDocument.Parse(xmlFile.text); var n = from key in doc.Root.Elements("Key") let kn = key from translate in kn.Elements("translate").Elements() where translate.Name == CurrentLanguage.ToString() select(kn.Attribute("Name").Value, translate.Value); foreach (var item in n) { TextTab.Add(item.Item1, item.Item2); } }
private void SetLanguageGui_Load(object sender, System.EventArgs e) { string ActionReturnParameterValue = string.Empty; // Languagelist oCLI.Execute("GetProjectLanguages", acc); acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue); string[] ProjectLanguages = ActionReturnParameterValue.Split(';'); // VariableLanguage oCLI.Execute("GetVariableLanguage", acc); acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue); string VariableLanguage = ActionReturnParameterValue; // Add languages foreach (string CurrentLanguage in ProjectLanguages) { if (CurrentLanguage != "") { ListViewItem liviItem = new ListViewItem(); // Check if current language if (CurrentLanguage.Equals(VariableLanguage)) { liviItem.Selected = true; } liviItem.Text = CurrentLanguage; // LanguageMapping foreach (string line in EplanLanguageList) { if (line.StartsWith(CurrentLanguage)) { if (line.Split(';').Length > 1) { liviItem.SubItems.Add(line.Split(';')[1]); } } } liviLanguages.Items.Add(liviItem); } } // Sort & resize liviLanguages.Sorting = SortOrder.Ascending; liviLanguages.Sort(); }
private static void LoadLocalization() { string currentLanguage = PlayerPrefs.GetString("language", "English"); language = (CurrentLanguage)System.Enum.Parse(typeof(CurrentLanguage), currentLanguage, true); string fileName = GlobalConsts.GetDataPath() + "/GameData/Localization/" + language.ToString() + ".json"; if (!System.IO.File.Exists(fileName)) { fileName = GlobalConsts.GetDataPath() + "/GameData/Localization/English.json"; if (!System.IO.File.Exists(fileName)) { System.IO.File.WriteAllText(fileName, "{}"); } } string rawJSON = JSONSystem.JSON.GetRawJSONFromFile(fileName); localizedStrings = JSONSystem.JSON.Parse(rawJSON) as JSONClass; }
public string GetLanguageText(CurrentLanguage curLan) { switch (curLan) { case CurrentLanguage.E_CN: return(zh_CN); case CurrentLanguage.E_TW: return(zh_TW); case CurrentLanguage.E_JA: return(ja_JP); default: return(zh_CN); } }
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); }
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); }
private static Hashtable GetLocalizedData() { string currentLanguage = CurrentLanguage.ToUpperInvariant(); if (TranslationData.Count == 0) { Logger.Write("TranslationData was empty, trying to re-read the xml.", Logger.Severity.Info); ReadLanguages(); } if (TranslationData.Contains(currentLanguage)) { return((Hashtable)TranslationData[currentLanguage]); } if (TranslationData.Contains(DefaultLanguageValue)) { return((Hashtable)TranslationData[DefaultLanguageValue]); } return(new Hashtable(0)); }
private void CreateTranslator() { var changedLanguage = _nccLanguageDetector.GetCurrentLanguage(); if (string.IsNullOrEmpty(changedLanguage)) { changedLanguage = "en"; } if (string.IsNullOrEmpty(CurrentLanguage)) { CurrentLanguage = changedLanguage; } if (!CurrentLanguage.Equals(changedLanguage) || _nccTranslator == null) { _nccTranslator = new NccTranslator(changedLanguage); CurrentLanguage = changedLanguage; } }
private List <HotelViewModel> RenderImages(List <HotelViewModel> model) { if (CurrentLanguage.Equals("us")) { foreach (var m in model) { var image = _basedb.ImageStore.Where(o => o.ReferIdUS == m.ID).FirstOrDefault(); m.Image = image == null ? 0 : image.ID; } } else { foreach (var m in model) { var image = _basedb.ImageStore.Where(o => o.ReferIdZH == m.ID).FirstOrDefault(); m.Image = image == null ? 0 : image.ID; } } return(model); }
protected override Task UpdateConfigAsync() { ConfigData.GLI_Mode = new RayGLI_Mode() { ColorMode = IsTextures32Bit ? 32 : 16, IsWindowed = !FullscreenMode, ResX = GraphicsMode.Width, ResY = GraphicsMode.Height, }.ToString(); ConfigData.FormattedTriLinear = TriLinear; ConfigData.FormattedTnL = TnL; ConfigData.FormattedTexturesCompressed = CompressedTextures; ConfigData.Video_WantedQuality = VideoQuality.ToString(); ConfigData.FormattedVideo_AutoAdjustQuality = AutoVideoQuality; ConfigData.Video_BPP = IsVideo32Bpp ? "32" : "16"; ConfigData.Language = CurrentLanguage.ToString(); ConfigData.TexturesFile = $"Tex{(IsTextures32Bit ? 32 : 16)}.cnt"; return(Task.CompletedTask); }
private void TsbDelete_Click(object sender, System.EventArgs e) { if (imageLibraryListBox1.SelectedIndexes.Length > 0) { string msg = CurrentLanguage.GetText("Are you sure delete the selected items?"); if (Helper.ShowMessage(msg, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { imageLibraryListBox1.SuspendLayout(); int[] items = imageLibraryListBox1.SelectedIndexes; for (int i = items.Length - 1; i >= 0; i--) { int index = items[i]; Picture pic = imageLibraryListBox1.Items[index]; if (MyIconLibrary.Share.Delete(pic)) { imageLibraryListBox1.Items.RemoveAt(index); } } imageLibraryListBox1.ResumeLayout(); } } }
private string GetText(string key, SystemLanguage lang, out bool success) { if (string.IsNullOrEmpty(key)) { success = false; return("#empty_localization_key"); } key = key.Trim(); if (dict.TryGetValue(lang, out Dictionary <string, string> keys) == false) { if (warnings.Contains(CurrentLanguage.ToString()) == false) { Warn($"{CurrentLanguage} is not localized!"); } success = false; return(key); } if (keys.TryGetValue(key, out string result) == false) { Warn($"Localization key <b>{key}</b> for <b>{lang}</b> is not localized!"); success = false; return(key); } if (string.IsNullOrEmpty(result)) { success = false; } success = true; return(result); }
public static string GetLocalizedValue(this Languages lang, string key) => Dictionary[CurrentLanguage.ToCultureInfoString()]?[key];
private void GenerateLines_Click(object sender, RoutedEventArgs e) { CurrentLanguage.GenerateLines(numberGenerateLines); UpdateTextView(CurrentLanguage.GeneratedText.ToString(), ViewMode.Generated); }
private void GenerateWords_Click(object sender, RoutedEventArgs e) { CurrentLanguage.GenerateWords(numberGenerateWords); }