private int ImportExcelFileAndCreateTags(Languages excelSelectedLanguage, int categoryIndex, int tagNameIndex, int contentIndex) { LanguageFile newFile = new LanguageFile(m_englishFile, excelSelectedLanguage); List <LanguageFileEntry> excelEntries = ExcelManager.ImportExcelFileEntries(excelPath, categoryIndex, tagNameIndex, contentIndex); if (excelIgnoreHeaderLine) { excelEntries.RemoveAt(0); } //neue keys hinzufügen foreach (LanguageFileEntry entry in excelEntries) { if (!m_newTagList.Contains(entry.textTag)) { m_newTagList.Add(entry.textTag); } //Im EnglishFile nur Key hinzufügen, wenn noch nicht da m_englishFile.SetEntry(entry.textTag); newFile.SetEntry(entry.textTag, entry); } //neues file schreiben LocalizationManager.WriteNewLanguageFile(excelSelectedLanguage, newFile); //neues File reloaden, wenn ausgewählt if (m_loadedLanguage == excelSelectedLanguage) { m_secondLanguageFile = LocalizationManager.GetLanguageDataFromFile(excelSelectedLanguage); } return(excelEntries.Count); }
public static void Load() { foreach (var p in typeof(Settings).GetProperties()) { var value = SettingsFile.GetValue(SettingsSection, p.Name, ""); object convertedValue; if (p.PropertyType == typeof(LanguageFile)) { convertedValue = LanguageFile.LoadFromDefault(value); } else if (p.PropertyType == typeof(WindowBorderSkin)) { convertedValue = WindowBorderSkinProvider.LoadTheme(value.Split(',')[0], value.Split(',')[1]); } else if (p.PropertyType == typeof(ExplorerSkin)) { convertedValue = ExplorerSkin.LoadTheme(value.Split(',')[0], value.Split(',')[1]); } else { convertedValue = Convert.ChangeType(value, p.PropertyType); } p.SetValue(null, convertedValue, null); } PropertyChanged += AutoSave; }
public void TestRowAndColumnMethods() { const string CELL_VALUE = "Test Value"; LanguageFile languageFile = new LanguageFile(); languageFile.AddRow(); languageFile.AddColumn(); languageFile[0][0] = CELL_VALUE; Assert.AreEqual(languageFile.ColumnCount, 1, "Column count is incorrect"); Assert.AreEqual(languageFile.RowCount, 1, "Row count is incorrect"); Assert.AreEqual(languageFile[0][0], CELL_VALUE, "Row value is incorrect"); languageFile.RemoveColumn(0); Assert.Throws(typeof(ArgumentOutOfRangeException), () => { languageFile[0][0] = CELL_VALUE; }, "Column not removed"); languageFile.RemoveRow(0); Assert.Throws(typeof(ArgumentOutOfRangeException), () => { languageFile[0][0] = CELL_VALUE; }, "Row not removed"); }
public void LoadLanguageFile() { LanguageFile languageFile = new LanguageFile(new FileInfo("Language-ja.json")); Assert.True(languageFile.GetCulture() == CultureInfo.CurrentCulture.Name); Assert.True(languageFile.GetContent <Content.LanguageFileText>("test_msg").Content == "Hello World!!"); }
protected void Page_Load(object sender, EventArgs e) { // Load Site Settings b = (SiteSettings)Cache["SiteSettings"]; // Load Language File Lang = (LanguageFile)Cache["LanguageFile"]; lblError.Text = ""; lblSuccess.Text = ""; if (User.Identity.IsAuthenticated == true) { trDate.Visible = true; inSubDate.Text = DateTime.Now.ToShortDateString(); } else { trDate.Visible = false; } SetRequiredFields(); // Check to see if this user is on the blocked IP List DataLayer.SQLDataProvider data = new DataLayer.SQLDataProvider(); if (data.CheckForBlockedIP(Request.UserHostAddress) == true) { // Users IP has been blocked so disable form btnSubmit.Visible = false; Alert(Lang.BlockedIP); } if (!Page.IsPostBack) { rblGender.Items.Add(new ListItem(Lang.Male, Lang.Male)); rblGender.Items.Add(new ListItem(Lang.Female, Lang.Female)); rblGender.Items.Add(new ListItem(Lang.Unspecified, Lang.Unspecified)); LoadCountries(); LoadStates(); lblSignOurGuestbook.Text = Lang.SignOurGuestbook; lnkBackToGuestbook.Text = Lang.BacktoGuestbook; lblBoldField.Text = "*" + Lang.Boldfield; lblFullname.Text = Lang.FullName; lblCountry.Text = Lang.Country; lblState.Text = Lang.State; lblEmail.Text = Lang.Email; lblHomepage.Text = Lang.Homepage; lblGuestbook.Text = Lang.Guestbook; lblGender.Text = Lang.Gender; lblMessage.Text = Lang.Message; lblSubmissionDate.Text = Lang.SubmissionDate; lblVerificationImage.Text = Lang.VerificationImage; lblFormError.Text = Lang.CompleteThisForm; btnCancel.Text = Lang.Cancel; btnSubmit.Text = Lang.Submit; } }
public void TestSaveMethod() { LanguageFile languageFile = new LanguageFile(); languageFile.Load(TEST_FILE); MemoryStream savedStream = new MemoryStream(); languageFile.Save(savedStream); savedStream.Seek(0, SeekOrigin.Begin); LanguageFile savedLanguageFile = new LanguageFile(); savedLanguageFile.Load(savedStream); savedStream.Close(); Assert.AreEqual(languageFile.RowCount, savedLanguageFile.RowCount, "Row counts do not match"); Assert.AreEqual(languageFile.ColumnCount, savedLanguageFile.ColumnCount, "Column counts do not match"); for (int i = 0; i < languageFile.RowCount; i++) { for (int j = 0; j < languageFile.ColumnCount; j++) { Assert.AreEqual(languageFile[i][j], savedLanguageFile[i][j], "Cell values do not match"); } } }
private void DrawLoadLanguageButton() { if (Enum.GetNames(typeof(Languages)).Length > 1) { EditorGUILayout.LabelField("Additional Language to load:"); EditorGUILayout.BeginHorizontal(); { foreach (string language in Enum.GetNames(typeof(Languages))) { if (language == Languages.English.ToString()) { continue; } if (GUILayout.Button(language)) { m_secondLanguageFile = LoadOrCreateLanguageFile((Languages)Enum.Parse(typeof(Languages), language)); m_loadedLanguage = m_secondLanguageFile.fileLanguage; } } } EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); } }
//INSTANT C# WARNING: Strict 'Handles' conversion only applies to 'WithEvents' fields declared in the same class - the event will be wired in 'SubscribeToEvents': //ORIGINAL LINE: Protected Sub btnSaveChanges_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSaveChanges.Click protected void btnSaveChanges_Click(object sender, System.EventArgs e) { if (b.DemoMode == false) { LanguageFile b = new LanguageFile(); b.BacktoGuestbook = this.inBacktoGuestbook.Text; b.BadLanguage = this.inBadLanguage.Text; b.BlockedIP = this.inBlockedIP.Text; b.Boldfield = this.inBoldFields.Text; b.Cancel = this.inCancel.Text; b.CompleteThisForm = this.inCompleteForm.Text; b.Country = this.inCountry.Text; b.Email = this.inEmail.Text; b.EnterEmailAddress = this.inEnterEmailAddress.Text; b.EnterFullName = this.inEnterFullName.Text; b.EnterGuestbook = this.inEnterGuestbook.Text; b.EnterHomepage = this.inEnterHomepage.Text; b.EnterMessage = this.inEnterMessage.Text; b.EnterNosHere = this.inEnterNos.Text; b.EnterVerificationImage = this.inEnterVerificationText.Text; b.Female = this.inFemale.Text; b.FullName = this.inFullName.Text; b.Guestbook = this.inGuestbook.Text; b.Gender = this.inGender.Text; b.Homepage = this.inHomepage.Text; b.VerificationDidNotMatch = this.inInvalidVerification.Text; b.Male = this.inMale.Text; b.Message = this.inMessage.Text; b.SelectCountry = this.inSelectCountry.Text; b.SelectState = this.inSelectState.Text; b.SignOurGuestbook = this.inSignBook.Text; b.State = this.inState.Text; b.SubmissionDate = this.inSubmissionDate.Text; b.SubmissionMessage = this.inSubmissionMessage.Text; b.Submit = this.inSubmit.Text; b.Unspecified = this.inUnspecified.Text; b.ValidEmailAddress = this.inValidEmail.Text; b.ValidGuestbookURL = this.inValidGuestbook.Text; b.ValidHomepageURL = this.inValidHomepage.Text; b.VerificationImage = this.inVerificationImage.Text; b.YourGuestbook = this.inYourGuestbook.Text; b.YourHomepage = this.inYourHomepage.Text; DataLayer.SQLDataProvider data = new DataLayer.SQLDataProvider(); if (data.UpdateLanguageFile(b) == true) { Cache["LanguageFile"] = b; Response.Redirect("LanguageFile.aspx"); } else { lblerror.Text = "Error while updating lanaguage file."; } } else { lblerror.Text = "You are not allowed to change these settings in demo mode."; } }
public void InitializeLanguageInfoStructs() { this.General = default(General); this.LanguageFile = default(LanguageFile); this.MainContextMenu = default(MainContextMenu); this.SettingsPanel = default(LanguageInformation.SettingsPanel); this.ErrorMessages = default(ErrorMessages); }
public AppState(Context context, IApplicationDataStorage dataStorage, Action <Intent> startActivity) { DataStorage = dataStorage; var languages = LoadLanguages(); LanguageFile = new LanguageFile(languages); TherapistCollection = new TherapistCollection(context, dataStorage, startActivity); //TherapistCollection.NotifiedTherapists.Add(TherapistCollection.AllTherapists.First()); }
private void LanguageList_SelectedIndexChanged(object sender, EventArgs args) { if (LanguageList.Text == Settings.Language.Name) { return; } Settings.Language = LanguageFile.LoadFromDefault(LanguageList.Text); ApplyLanguage(); ReBuildLangGroups(); }
public static void Main() { var german = new LanguageFile("de", 'u', 'v'); var english = new LanguageFile("en", 't', 'x'); var french = new LanguageFile("fr", 'q', 'w'); var atm = new AtmUserInterface(german, english, french); atm.Start(); }
private void SaveFiles() { bool isRefreshEnum = false; GUI.FocusControl(null); LocalizationManager.WriteNewLanguageFile(Languages.English, m_englishFile); if (m_secondLanguageFile.fileLanguage != Languages.English) { LocalizationManager.WriteNewLanguageFile(m_loadedLanguage, m_secondLanguageFile); } if (m_newTagList.Count > 0) { for (int i = 0; i < Enum.GetNames(typeof(Languages)).Length; i++) { if ((Languages)i != Languages.English) { LanguageFile otherFile = LoadOrCreateLanguageFile((Languages)i); LocalizationManager.WriteNewKeysToLanguageFile(otherFile.fileLanguage, m_newTagList, null); } } isRefreshEnum = true; } if (m_deleteTagList.Count > 0) { for (int i = 0; i < Enum.GetNames(typeof(Languages)).Length; i++) { LocalizationManager.RemoveTagsFromLanguageFile((Languages)i, m_deleteTagList); } m_deleteTagList.Clear(); isRefreshEnum = true; } if (isRefreshEnum) { RefreshTagEnum(); } if (Enum.IsDefined(typeof(Languages), (int)m_loadedLanguage)) { m_secondLanguageFile = LoadOrCreateLanguageFile(m_loadedLanguage); } m_newTagList.Clear(); isDirtyTags = false; isDirtyEng = false; isDirtySecond = false; }
public static LanguageFile WriteNewLanguageFile(Languages language, LanguageFile file) { string filePath = Application.dataPath + DirectoryPath + language.ToString() + ".lang"; file.fileLanguage = language; Directory.CreateDirectory(Application.dataPath + DirectoryPath); File.WriteAllText(filePath, file.GetJsonFormat()); AssetDatabase.Refresh(); return(file); }
public void GenerateLanguageFile() { LanguageFile languagesFile = new LanguageFile(); fileKeys.ForEach(key => { languagesFile.SetEntry(key); }); string filePath = Application.dataPath + DirectoryPath + "LanguageXX.lang"; File.WriteAllText(filePath, languagesFile.GetJsonFormat()); AssetDatabase.Refresh(); }
public static LanguageFile GetLanguageDataFromFile(string filePath) { if (!File.Exists(filePath)) { Debug.LogWarning("TekkTech: Language File " + filePath + " does not exist."); return(null); } LanguageFile tempLanguageFile = JsonUtility.FromJson <LanguageFile>(File.ReadAllText(filePath)); return(tempLanguageFile); }
private static void LoadLanguageFromFile(Languages LanguageToLoad) { currentLanguage = LanguageToLoad; string filePath = Application.dataPath + DirectoryPath + currentLanguage.ToString() + ".lang"; m_loadedLanguageFile = GetLanguageDataFromFile(filePath); for (int i = 0; i < registeredLanguageStrings.Count; i++) { registeredLanguageStrings[i].LanguageSwitch(); } }
public LanguageFile(LanguageFile structFile, Languages language = Languages.English) { if (language != Languages.English) { fileLanguage = structFile.fileLanguage; } else { fileLanguage = language; } structFile.entries.ForEach(entry => { entries.Add(new LanguageFileEntry(entry.textTag, "")); }); }
private void LoadOrCreateEnglishFile() { GUILayout.Space(8); if (s_checkedForEnglishFile) { return; } m_englishFile = LoadOrCreateLanguageFile(Languages.English); FindAllCategories(); m_newTagList.Clear(); s_checkedForEnglishFile = true; }
private LanguageFile LoadOrCreateLanguageFile(Languages languageToLoad) { string path = Application.dataPath + LANGUAGES_RESOURCE_PATH + languageToLoad.ToString() + ".lang"; if (!File.Exists(path)) { LanguageFile newFile = new LanguageFile(m_englishFile, languageToLoad); return(LocalizationManager.WriteNewLanguageFile(languageToLoad, newFile)); } LanguageFile file = LocalizationManager.GetLanguageDataFromFile(path); return(file); }
protected void Page_Load(object sender, System.EventArgs e) { b = (SiteSettings)Cache["SiteSettings"]; lblerror.Text = ""; lblsuccess.Text = ""; if (!Page.IsPostBack) { lang = (LanguageFile)Cache["LanguageFile"]; this.inBacktoGuestbook.Text = lang.BacktoGuestbook; this.inBadLanguage.Text = lang.BadLanguage; this.inBlockedIP.Text = lang.BlockedIP; this.inBoldFields.Text = lang.Boldfield; this.inCancel.Text = lang.Cancel; this.inCompleteForm.Text = lang.CompleteThisForm; this.inCountry.Text = lang.Country; this.inEmail.Text = lang.Email; this.inEnterEmailAddress.Text = lang.EnterEmailAddress; this.inEnterFullName.Text = lang.EnterFullName; this.inEnterGuestbook.Text = lang.EnterGuestbook; this.inEnterHomepage.Text = lang.EnterHomepage; this.inEnterMessage.Text = lang.EnterMessage; this.inEnterNos.Text = lang.EnterNosHere; this.inEnterVerificationText.Text = lang.EnterVerificationImage; this.inFemale.Text = lang.Female; this.inFullName.Text = lang.FullName; this.inGuestbook.Text = lang.Guestbook; this.inGender.Text = lang.Gender; this.inHomepage.Text = lang.Homepage; this.inInvalidVerification.Text = lang.VerificationDidNotMatch; this.inMale.Text = lang.Male; this.inMessage.Text = lang.Message; this.inSelectCountry.Text = lang.SelectCountry; this.inSelectState.Text = lang.SelectState; this.inSignBook.Text = lang.SignOurGuestbook; this.inState.Text = lang.State; this.inSubmissionDate.Text = lang.SubmissionDate; this.inSubmissionMessage.Text = lang.SubmissionMessage; this.inSubmit.Text = lang.Submit; this.inUnspecified.Text = lang.Unspecified; this.inValidEmail.Text = lang.ValidEmailAddress; this.inValidGuestbook.Text = lang.ValidGuestbookURL; this.inValidHomepage.Text = lang.ValidHomepageURL; this.inVerificationImage.Text = lang.VerificationImage; this.inYourGuestbook.Text = lang.YourGuestbook; this.inYourHomepage.Text = lang.YourHomepage; } }
private TextCell GetTextCellFromTelefoneNumber(TelefoneNumber telefoneNumber) { var textCell = new TextCell { Detail = telefoneNumber.Number, DetailColor = Color.Blue, Text = LanguageFile.TranslateContactType(telefoneNumber.Type) }; if (telefoneNumber.Type == TelefoneNumber.TelefoneNumberType.Fax) { textCell.DetailColor = BlueGray; } textCell.Tapped += (o, e) => OpenTelefoneNumber(telefoneNumber); return(textCell); }
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) { int index = listBox1.SelectedIndex; if (index == -1) { return; } string culture = (string)listBox1.Items[index]; _selectedLanguageFile = _languageFiles[culture]; UpdateGrid(); }
private TableSection CreateOfficeTableSection() { var officeTableSection = new TableSection(LanguageFile.GetString("officeheader")); IEnumerable <Cell> CreateOfficeCells() { foreach (var office in Therapist.Therapist.Offices.Distinct()) { yield return(CreateOfficeCell(office)); } } officeTableSection.Add(CreateOfficeCells()); return(officeTableSection); }
private void Button2_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(textBox1.Text)) { MessageBox.Show("The folder is not selected.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Directory.CreateDirectory(textBox1.Text); LanguageFile languageFile = new LanguageFile(); languageFile.LanguageFileDictionary.CultureString = comboBox1.Text; languageFile.SaveFile( new FileInfo(textBox1.Text + "/" + comboBox1.Text + ".json")); Close(); }
private IEnumerable <TableSection> CreateQualificationTableSections() { var groupedQualifications = Therapist.Therapist.Qualifications.GroupBy(q => q.Category).ToList(); foreach (var groupedQualification in groupedQualifications) { var qualiesInGroup = groupedQualification.SelectMany(g => g.Content).Select(q => new TextCell { Text = LanguageFile.TranslateQualityName(q), TextColor = BlueGray }).ToList(); var title = LanguageFile.TranslateCategory(groupedQualification.Key); title = $"{LanguageFile.GetString("qualifications")} - {title}"; var section = new TableSection(title) { qualiesInGroup }; yield return(section); } }
protected void Page_Load(object sender, EventArgs e) { // Load Site Settings b = (SiteSettings)Cache["SiteSettings"]; // Load Language File Lang = (LanguageFile)Cache["LanguageFile"]; if (!Page.IsPostBack) { // Populate the grid with user entries LoadGrid(); } lblBookTitle.Text = b.GuestBookTitle; GridView1.PageSize = b.GuestbookGridSize; lnkSignBook.Text = Lang.SignOurGuestbook; }
private TableSection CreateLanguageTableSection() { var tableSection = new TableSection(LanguageFile.GetString("language")); var textCells = Therapist.Therapist.Languages.Select(l => LanguageFile.TranslateLanguage(l)).Select(l => new TextCell { Text = l, TextColor = BlueGray }).ToArray(); if (textCells.Any()) { tableSection.Add(textCells); } else { tableSection.Add(new TextCell { Text = LanguageFile.GetString("nolanguages"), TextColor = FadedBlueGray }); } return(tableSection); }
public static void RemoveTagsFromLanguageFile(Languages language, List <string> tagsToRemove) { if (tagsToRemove.Count == 0) { return; } string filePath = Application.dataPath + DirectoryPath + language.ToString() + ".lang"; LanguageFile languagesFile = new LanguageFile(); if (File.Exists(filePath)) { languagesFile = JsonUtility.FromJson <LanguageFile>(File.ReadAllText(filePath)); } tagsToRemove.ForEach(tag => { languagesFile.RemoveEntry(tag); }); WriteNewLanguageFile(language, languagesFile); }
private TableSection CreateOverallContactTableSection() { var tableSection = new TableSection(LanguageFile.GetString("contactheader")); IEnumerable <TextCell> textCells; if (Therapist.Therapist.TelefoneNumbers.Any()) { textCells = Therapist.Therapist.TelefoneNumbers.Select(GetTextCellFromTelefoneNumber); } else { textCells = Enumerable.Repeat(new TextCell { Text = LanguageFile.GetString("nocontactinformation"), TextColor = FadedBlueGray }, 1); } tableSection.Add(textCells); return(tableSection); }
private static void DoLoadFile(LanguageFile file) { TextAsset xmlText = (TextAsset)Resources.Load("Translation/" + file.name); if (xmlText != null) { XmlDocument xml = new XmlDocument(); xml.LoadXml(xmlText.text); XmlNodeList nodes = xml.GetElementsByTagName("message"); for (int i = 0; i < nodes.Count; i++) { LanguageFile.LanguageMessage message = new LanguageFile.LanguageMessage(); string id = nodes[i].Attributes["id"].Value; XmlNodeList childNodes = nodes[i].ChildNodes; for (int j = 0; j < childNodes.Count; j++) if (childNodes[j].LocalName == "language") { if (childNodes[j].Attributes["type"] != null) { if (childNodes[j].Attributes["type"].Value == "PT") { if (!message.messageByLang.ContainsKey("PT")) message.messageByLang.Add("PT", childNodes[j].InnerXml); } else if (childNodes[j].Attributes["type"].Value == "EN") { if (!message.messageByLang.ContainsKey("EN")) message.messageByLang.Add("EN", childNodes[j].InnerXml); } else if (childNodes[j].Attributes["type"].Value == "ES") { if (!message.messageByLang.ContainsKey("ES")) message.messageByLang.Add("ES", childNodes[j].InnerXml); } else if (childNodes[j].Attributes["type"].Value == "PT_PT") { if (!message.messageByLang.ContainsKey("PT_PT")) message.messageByLang.Add("PT_PT", childNodes[j].InnerXml); } } else message.defaultMessage = childNodes[j].InnerXml; if (message.defaultMessage == null || message.defaultMessage == "") { if (message.messageByLang.ContainsKey("EN")) message.defaultMessage = message.messageByLang["EN"]; else foreach (KeyValuePair<string, string> messageByLang in message.messageByLang) { message.defaultMessage = messageByLang.Value; break; } } } if (!(id == null || id == "")) { file.messages.Add(id, message); } } file.isLoaded = true; } else Debug.Log("Fail on loading \'Translation/" + file.name + "\'"); }