コード例 #1
0
ファイル: MockSessionProvider.cs プロジェクト: peters/i18n
 protected void Initialize()
 {
     Controller = MockHelper.FakeController();
     Controller.SetFakeControllerContext(new NameValueCollection
                                             {
                                                 {"Accept-Language", "en"}
                                             });
     Session = new I18NSession();
     LocalizingService = new LocalizingService();
 }
コード例 #2
0
ファイル: I18NSessionTests.cs プロジェクト: asapostolov/i18n
        public void LoadFromDisk()
        {
            var context = A.Fake <HttpContextBase>();

            A.Fake <HttpSessionStateBase>(x => x.Wrapping(context.Session).Implements(typeof(HttpSessionStateWrapper)));

            LocalizingService.LoadFromDiskAndCache("bg-BG", @"C:\GitHub\Property\Property.Web\locale\bg-BG\messages.po");

            var session = new I18NSession();

            session.Set(context, "bg-BG");

            var text = session.GetText(context, "Login in bilid", "bg-BG");

            Assert.True(true);

            Assert.AreEqual("Вход в bilid", text);
        }
コード例 #3
0
ファイル: MockSessionProvider.cs プロジェクト: peters/i18n
 protected string _(string text, LocalizingService service, string[] languages)
 {
     return LocalizingService.GetText(text, languages);
 }