private static void AddFrenchTmx(string folderPath) { var doc = new TMXDocument { Header = { SourceLang = "fr" } }; // first unit var variants = new List <TransUnitVariant> { new TransUnitVariant { Lang = "en", Value = "blah" }, new TransUnitVariant { Lang = "fr", Value = "blahInFrench" } }; var tu = new TransUnit { Id = "blahId", Variants = variants }; tu.AddProp("ar", LocalizedStringCache.kDiscoveredDyanmically, "true"); tu.AddProp("en", LocalizedStringCache.kDiscoveredDyanmically, "true"); doc.AddTransUnit(tu); doc.Save(Path.Combine(folderPath, LocalizationManager.GetTmxFileNameForLanguage(AppId, "fr"))); }
private static void AddEnglishTmx(string folderPath, string appVersion) { var englishDoc = new TMXDocument { Header = { SourceLang = "en" } }; if (!String.IsNullOrEmpty(appVersion)) { englishDoc.Header.SetPropValue(LocalizationManager.kAppVersionPropTag, appVersion); } // first unit var variants = new List <TransUnitVariant> { new TransUnitVariant { Lang = "en", Value = "from English TMX" } }; var tu = new TransUnit { Id = "theId", Variants = variants }; tu.AddProp("en", LocalizedStringCache.kDiscoveredDyanmically, "true"); englishDoc.AddTransUnit(tu); // second unit var variants2 = new List <TransUnitVariant> { new TransUnitVariant { Lang = "en", Value = "no longer used English text" } }; var prop = new TMXProp(); prop.Type = LocalizedStringCache.kNoLongerUsedPropTag; prop.Value = "true"; var tu2 = new TransUnit { Id = "notUsedId", Variants = variants2, Props = { prop } }; englishDoc.AddTransUnit(tu2); // third unit var variants3 = new List <TransUnitVariant> { new TransUnitVariant { Lang = "en", Value = "blah" } }; var tu3 = new TransUnit { Id = "blahId", Variants = variants3 }; englishDoc.AddTransUnit(tu3); englishDoc.Save(Path.Combine(folderPath, LocalizationManager.GetTmxFileNameForLanguage(AppId, "en"))); }
private static void MakeEnglishTmxWithApparentOrphan(TempFolder folder) { var englishDoc = new TMXDocument { Header = { SourceLang = "en" } }; englishDoc.Header.SetPropValue(LocalizationManager.kAppVersionPropTag, LowerVersion); englishDoc.AddTransUnit(MakeTransUnit("en", null, "Title", "SuperClassMethod.TestId", false)); // This is the one ID found in our test code englishDoc.AddTransUnit(MakeTransUnit("en", null, "Title", "AnotherContext.AnotherDialog.TestId", true)); // Simulates an 'orphan' that we can't otherwise tell we need. Directory.CreateDirectory(GetInstalledDirectory(folder)); englishDoc.Save(Path.Combine(GetInstalledDirectory(folder), LocalizationManager.GetTmxFileNameForLanguage(AppId, "en"))); }
private static void MakeArabicTmxWithApparentOrphans(TempFolder folder, string englishForObsoleteTitle) { var arabicDoc = new TMXDocument { Header = { SourceLang = "ar" } }; arabicDoc.Header.SetPropValue(LocalizationManager.kAppVersionPropTag, LowerVersion); // Note that we do NOT have arabic for SuperClassMethod.TestId. We may end up getting a translation from the orphan, however. arabicDoc.AddTransUnit(MakeTransUnit("ar", "Title", "Title in Arabic", "AnotherContext.AnotherDialog.TestId", true)); // Not an orphan, because English TMX has this too // Interpreted as an orphan iff englishForObsoleteTitle is "Title" (matching the English for SuperClassMethod.TestId) arabicDoc.AddTransUnit(MakeTransUnit("ar", englishForObsoleteTitle, "Title in Arabic", "AnObsoleteNameForSuperclass.TestId", true)); Directory.CreateDirectory(GetInstalledDirectory(folder)); arabicDoc.Save(Path.Combine(GetInstalledDirectory(folder), LocalizationManager.GetTmxFileNameForLanguage(AppId, "ar"))); }
private static void AddArabicTmx(string folderPath) { var arabicDoc = new TMXDocument { Header = { SourceLang = "ar" } }; // first unit var variants = new List <TransUnitVariant> { new TransUnitVariant { Lang = "en", Value = "wrong" }, new TransUnitVariant { Lang = "ar", Value = "inArabic" } }; var tu = new TransUnit { Id = "theId", Variants = variants }; tu.AddProp("ar", LocalizedStringCache.kDiscoveredDyanmically, "true"); tu.AddProp("en", LocalizedStringCache.kDiscoveredDyanmically, "true"); arabicDoc.AddTransUnit(tu); // second unit var variants2 = new List <TransUnitVariant> { new TransUnitVariant { Lang = "en", Value = "inEnglishpartofArabicTMX" }, new TransUnitVariant { Lang = "ar", Value = "inArabic" } }; var tu2 = new TransUnit { Id = "notUsedId", Variants = variants2 }; tu2.AddProp("ar", LocalizedStringCache.kDiscoveredDyanmically, "true"); tu2.AddProp("en", LocalizedStringCache.kDiscoveredDyanmically, "true"); // Note: we are NOT adding a NoLongerUsed property to the Arabic TMX arabicDoc.AddTransUnit(tu2); arabicDoc.Save(Path.Combine(folderPath, LocalizationManager.GetTmxFileNameForLanguage(AppId, "ar"))); }