private void CheckTranslation(Api.Translation translation) { var api = new Api.ClientApi(_configuration); //translation = api.GetTranslation(_configuration.ActiveProject, _resources[index_resource].slug, translation); if (!translation.reviewed && string.IsNullOrWhiteSpace(translation.translation)) { _translations[index_translation] = translation; textToBeTranslated.Text = translation.source_string; listBox1.Items.Clear(); listBox2.Items.Clear(); for (int i = index_translation - 5; i < index_translation; i++) { if (i >= 0) { listBox1.Items.Add(_translations[i].source_string + " - " + _translations[i].translation); } } for (int i = index_translation + 1; i <= index_translation + 5; i++) { if (i < _translations.Count) { listBox2.Items.Add(_translations[i].source_string + " - " + _translations[i].translation); } } } else { index_translation++; } }
private void button1_Click_1(object sender, EventArgs e) { try { var api = new Api.ClientApi(new Base.Configuration() { Username = usernameText.Text, Password = passwordText.Text }); var projectInfo = api.InfoProject(projectNameTextbox.Text); if (projectInfo != null) { labelProject.Text = projectInfo.description; labelSourceLanguage.Text = projectInfo.source_language_code; isProjectRight = true; LoadResouces(); } else { MessageBox.Show("The project doesn't exist. Check again the name.", "Nothing"); } } catch (Exception ex) { MessageBox.Show("Try again. It's a network problem.", "Sorry!"); } }
private void LoadTranslations() { if (index_resource < _resources.Count) { var api = new Api.ClientApi(_configuration); _translations = api.Translations(_configuration.ActiveProject, _resources[index_resource].slug); _translations = _translations.OrderBy(x => int.Parse(x.key)).ToList(); } }
private void LoadResouces() { var api = new Api.ClientApi(new Base.Configuration() { Username = usernameText.Text, Password = passwordText.Text }); var resources = api.ProjectResources(projectNameTextbox.Text); cmbResources.DataSource = resources; cmbResources.DisplayMember = "name"; cmbResources.ValueMember = "slug"; }
private bool UpdateTranslation() { if (index_resource < _resources.Count) { if (index_translation < _translations.Count) { _translations[index_translation].translation = richTextBox2.Text; var api = new Api.ClientApi(_configuration); return(api.UpdateTranslation(_configuration.ActiveProject, _resources[index_resource].slug, _translations[index_translation])); } } return(false); }
private void LoadConfiguration() { _configuration = Base.Configuration.GetDefault(); if (_configuration != null) { this.Text = string.Format("Transifex - Translator Helper - {0}", _configuration.ActiveProject); this.statusLabel.Text = string.Format("Project: {0} - Username: {1} - {2}", _configuration.ActiveProject, _configuration.Username, _configuration.LanguadeCode); var api = new Api.ClientApi(_configuration); _resources = api.ProjectResources(_configuration.ActiveProject); index_resource = _configuration.ActualIndexResource; index_translation = _configuration.ActualIndexTranslation; LoadTranslations(); LoadNextSentence(); } }
private void button3_Click(object sender, EventArgs e) { try { var api = new Api.ClientApi(new Base.Configuration() { Username = usernameText.Text, Password = passwordText.Text }); var languages = api.Languages(); comboLanguage.DataSource = languages; comboLanguage.DisplayMember = "name"; comboLanguage.ValueMember = "code"; } catch (Exception ex) { MessageBox.Show("Try again. It's a network problem.", "Sorry!"); } }
private void LoadConfiguration() { var configuration = Base.Configuration.GetDefault(); if (configuration != null) { usernameText.Text = configuration.Username; passwordText.Text = configuration.Password; timeNumeric.Value = configuration.TimeBetweenTranslation; var api = new Api.ClientApi(configuration); var languages = api.Languages(); comboLanguage.DataSource = languages; comboLanguage.DisplayMember = "name"; comboLanguage.ValueMember = "code"; comboLanguage.SelectedValue = configuration.LanguadeCode; projectNameTextbox.Text = configuration.ActiveProject; isProjectRight = true; LoadResouces(); cmbResources.SelectedIndex = configuration.ActualIndexResource; } }