public static void Begin(ModContentPack modContentPack, LoadedLanguage targetLanguage) { Mode = TranslationFilesMode.GenerateForMod; ModContentPack = modContentPack; TargetLanguage = targetLanguage; OriginalActiveLanguage = LanguageDatabase.activeLanguage; //Logging.Log(ToString(), "TranslationFilesGenerator.Begin"); // Note: LanguageDatabase.activeLanguage is only changed within DoCleanupTranslationFiles, // so that confirmation dialogs and such are still translated in the current active language. TranslationFilesCleaner.CleanupTranslationFiles(); }
public static void DoTranslationInfoRect(Rect outRect) { if (LanguageDatabase.activeLanguage == LanguageDatabase.defaultLanguage) { return; } Widgets.DrawWindowBackground(outRect); Rect rect = outRect.ContractedBy(8f); GUI.BeginGroup(rect); rect = rect.AtZero(); Rect rect2 = new Rect(5f, rect.height - 25f, rect.width - 10f, 25f); rect.height -= 29f; Rect rect3 = new Rect(5f, rect.height - 25f, rect.width - 10f, 25f); rect.height -= 29f; Rect rect4 = new Rect(5f, rect.height - 25f, rect.width - 10f, 25f); rect.height -= 29f; string text = string.Empty; foreach (CreditsEntry creditsEntry in LanguageDatabase.activeLanguage.info.credits) { CreditRecord_Role creditRecord_Role = creditsEntry as CreditRecord_Role; if (creditRecord_Role != null) { text = text + creditRecord_Role.creditee + "\n"; } } text = text.TrimEndNewlines(); string label = "TranslationThanks".Translate(new object[] { text }) + "\n\n" + "TranslationHowToContribute".Translate(); Widgets.LabelScrollable(rect, label, ref MainMenuDrawer.translationInfoScrollbarPos, false, false); if (Widgets.ButtonText(rect4, "LearnMore".Translate(), true, false, true)) { Application.OpenURL(MainMenuDrawer.TranslationsContributeURL); } if (Widgets.ButtonText(rect3, "SaveTranslationReport".Translate(), true, false, true)) { LanguageReportGenerator.SaveTranslationReport(); } if (Widgets.ButtonText(rect2, "CleanupTranslationFiles".Translate(), true, false, true)) { TranslationFilesCleaner.CleanupTranslationFiles(); } GUI.EndGroup(); }