Ejemplo n.º 1
0
        public void ShouldGetTranslatedPhrase()
        {
            _langResources.SetLanguage("Es");
            var actual   = _langResources.GetPhrase(PhraseKey);
            var expected = _phrasesEs;

            Assert.Contains(actual, expected);
        }
Ejemplo n.º 2
0
        static LanguageHelper()
        {
            if (View.IsDesignMode)
            {
                // 在设计状态下只能通过Resource模式加载多语言资源
                _resources = new LanguageResources("/WPFPrototype.Toolkit;component/Assets/Languages/", LanguageResourceTypes.Resource);
            }
            else
            {
                // 通过Content模式加载多语言资源
                _resources = new LanguageResources("/Languages/", LanguageResourceTypes.Content);
                // 通过File模式加载多语言资源
                //_resources = new LanguageResources("Languages/", LanguageResourceTypes.File);
            }

            _resources.SetLanguage("en-us");
        }