예제 #1
0
        private static void LoadLocalization()
        {
            Console.WriteLine("App.LoadLocalization() Ready to load localization from current directory.");
            string settingFilePath = Path.Combine(AppUtility.GetCurrentExePath(),
                                                  LocalizationCenter.FOLDER_LOCALIZATION, "localSetting");
            string langCode = string.Empty;

            if (!File.Exists(settingFilePath))
            {
                File.WriteAllText(settingFilePath, LocalizationCenter.DEFAULT_LOCALIZATION_NOTSET);
                langCode = CultureInfo.CurrentCulture.Name;
            }
            else
            {
                langCode = File.ReadAllText(settingFilePath);
                if (langCode.Equals(LocalizationCenter.DEFAULT_LOCALIZATION_NOTSET))
                {
                    langCode = CultureInfo.CurrentCulture.Name;
                }
            }

            string localFilePath = Path.Combine(AppUtility.GetCurrentExePath(),
                                                LocalizationCenter.FOLDER_LOCALIZATION, langCode + ".json");

            if (!File.Exists(localFilePath))
            {
                langCode = LocalizationCenter.DEFAULT_LOCALIZATION_RESOURCE_LANGCODE;
                return;
            }

            LocalizationCenter.SetLocalizationData(langCode, File.ReadAllText(localFilePath));
        }
예제 #2
0
        public void RequestEnglishLocalizationFile()
        {
            string result = LocalizationCenter.RequestModelJson();

            _output.WriteLine(result);
            File.WriteAllText(Path.Combine(workingDirectory, jsonFile), result);
        }