Ejemplo n.º 1
0
        private static bool InitializeCustom(string langId)
        {
            var found = false;

            var googleSheets = GetGoogleSheetsFilename();

            if (File.Exists(googleSheets))
            {
                try {
                    var loaded = SharedLocaleReader.Read(googleSheets, langId);
                    if (loaded.Any())
                    {
                        CustomResourceManager.SetCustomSource(loaded);
                        found = true;
                    }
                } catch (Exception e) {
                    Logging.Warning(e);
                }
            }

            if (SettingsHolder.Locale.ResxLocalesMode)
            {
                var localeDirectory = FilesStorage.Instance.Combine("Locales", langId);
                if (Directory.Exists(localeDirectory))
                {
                    Logging.Write(localeDirectory);
                    CustomResourceManager.SetCustomSource(localeDirectory);
                    found = true;
                }
            }

            return(found);
        }
Ejemplo n.º 2
0
        public void Test()
        {
            var read = SharedLocaleReader.Read(Path.Combine(TestDir, "test.xlsx"), "ru");

            Assert.AreEqual("Крут. момент:", read["AppStrings"]["CarSpecs_TorqueLabel"]);
            Assert.IsFalse(read["AppStrings"].ContainsKey("Settings_Locale_LoadCustom"));

            var nothing = SharedLocaleReader.Read(Path.Combine(TestDir, "test.xlsx"), "pl");

            Assert.AreEqual(0, nothing.Count);
        }