// Initializes localization. public static void Initialize(PersistentData data) { ScanLocaleDirectory(); string language = null; if (!string.IsNullOrEmpty(data.Options.Language)) language = data.Options.Language; // No language in options, try to match OS language. if (language == null) language = MatchLanguage(CultureInfo.InstalledUICulture); // Apply default language if no suitable language was found. if (language == null) Apply(); else { // Apply default language, if language change fails. if (!SetLanguage(language)) Apply(); } }
// Creates empty file with language option set. public static void CreateSetupTemplate(string path, string language) { PersistentData data = new PersistentData(); data.Options.Language = language; data.SavePersistentDataToFileEx(Path.Combine(path, "PersistentData.xml")); }