public TranslationMemory(FileBasedTranslationMemory tm) { var languageFlags = new LanguageFlags(); _sourceStatusToolTip = "Nothing processed yet"; _targetStatusToolTip = "Nothing processed yet"; _isSelected = false; _sourceStatus = ""; _targetStatus = ""; Tm = tm; SourceLanguageFlagUri = languageFlags.GetImageStudioCodeByLanguageCode(tm.LanguageDirection.SourceLanguage.Name); TargetLanguageFlagUri = languageFlags.GetImageStudioCodeByLanguageCode(tm.LanguageDirection.TargetLanguage.Name); SourceLanguage = tm.LanguageDirection.SourceLanguage.Name; TargetLanguage = tm.LanguageDirection.TargetLanguage.Name; }
private void SetSourceFields(LanguageFlags languageFlags, IEntryLanguage entrySourceLanguage) { pictureBoxSource.Load(languageFlags.GetImageStudioCodeByLanguageCode(entrySourceLanguage.Locale.Name)); lblSourceLanguageText.Text = entrySourceLanguage.Name; var sourceTerms = entrySourceLanguage.Terms; if (sourceTerms.Count > 0) { lblSourceTermText.Text = Utils.UppercaseFirstLetter(sourceTerms[0].Value); txtSourceDefinitionText.Text = sourceTerms[0].Fields.Where(f => f.Name.Equals("Definition")).FirstOrDefault() != null ? Utils.UppercaseFirstLetter(sourceTerms[0].Fields.Where(f => f.Name.Equals("Definition")).FirstOrDefault().Value) : string.Empty; lblSourceDomainText.Text = sourceTerms[0].Fields.Where(f => f.Name.Equals("Domain")).FirstOrDefault() != null ? Utils.UppercaseFirstLetter(sourceTerms[0].Fields.Where(f => f.Name.Equals("Domain")).FirstOrDefault().Value.ToLower()) : string.Empty; lblSourceSubdomainText.Text = sourceTerms[0].Fields.Where(f => f.Name.Equals("Subdomain")).FirstOrDefault() != null ? sourceTerms[0].Fields.Where(f => f.Name.Equals("Subdomain")).FirstOrDefault().Value : string.Empty; lblSourceSubdomainText.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(lblTargetSubdomainText.Text.ToLower()); lblSourceTermTypeText.Text = sourceTerms[0].Fields.Where(f => f.Name.Equals("TermType")).FirstOrDefault() != null ? Utils.UppercaseFirstLetter(sourceTerms[0].Fields.Where(f => f.Name.Equals("TermType")).FirstOrDefault().Value) : string.Empty; } }
private void WriteLanguage(IEntryLanguage language, bool isSource, XmlWriter xmlTxtWriter) { var languageFlags = new LanguageFlags(); var fullPath = languageFlags.GetImageStudioCodeByLanguageCode(language.Locale.Name); xmlTxtWriter.WriteStartElement("Language"); xmlTxtWriter.WriteAttributeString("Name", language.Name); xmlTxtWriter.WriteAttributeString("CultureInfo", language.Locale.Name); xmlTxtWriter.WriteAttributeString("TwoLetterISOLanguageName", language.Locale.TwoLetterISOLanguageName); xmlTxtWriter.WriteAttributeString("IsSource", isSource.ToString()); xmlTxtWriter.WriteAttributeString("FlagFullPath", File.Exists(fullPath) ? fullPath : string.Empty); WriteFields(language.Fields, xmlTxtWriter); WriteTerms(language, xmlTxtWriter); xmlTxtWriter.WriteEndElement(); //Language }