Пример #1
0
        // 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();
            }
        }
Пример #2
0
 // 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"));
 }