using HarmonyLib; using OWML.Common; using OWML.ModHelper; namespace SlovakTranslation { /// /// Registers Slovenčina as a selectable language via xen-42's Localization /// Utility (xen.LocalizationUtility). All the heavy lifting lives in the /// utility; this mod just points it at our translated strings and patches the /// few menu/HUD fonts that were never baked with Slovak glyphs (see /// ). /// public class SlovakTranslation : ModBehaviour { public static SlovakTranslation Instance; /// Name the language is registered (and displayed) under. public const string LanguageName = "Slovenčina"; /// Path (relative to the mod folder) to the translated strings. public static string translationFile = "assets/Translation.xml"; /// The Localization Utility's API, kept for reflection in . internal static ILocalizationAPI LocalizationApi; private void Start() { Instance = this; LocalizationApi = ModHelper.Interaction.TryGetModApi("xen.LocalizationUtility"); if (LocalizationApi == null) { ModHelper.Console.WriteLine( "Could not find xen.LocalizationUtility — is Interplanetary Polyglot installed?", MessageType.Error); return; } LocalizationApi.RegisterLanguage(this, LanguageName, translationFile); ModHelper.Console.WriteLine("Registered language: " + LanguageName, MessageType.Success); // Deliberately *not* AddLanguageFont: that would make IsLanguageLatin false // and pull dialogue, the translator and the ship log off their correct // vanilla fonts. We only patch the fonts that can't draw Slovak. SlovakFont.Load(this); if (SlovakFont.Loaded) { new Harmony("Homer.SlovakTranslation").PatchAll(); ModHelper.Console.WriteLine("Slovak menu/HUD font (Cabin) loaded and patched in.", MessageType.Success); } } } }