Exemplo n.º 1
0
    def test_ungettext_with_args(self, monkeypatch):
        self.setup_monkeypatch(monkeypatch)

        i18n.ungettext("one book", "%(n)d books", 1, n=1) == "one book"
        i18n.ungettext("one book", "%(n)d books", 2, n=2) == "2 books"

        web.ctx.lang = 'fr'
        self.d.init('fr', {
            'one book': 'un libre',
            '%(n)d books': '%(n)d libres',
        })

        i18n.ungettext("one book", "%(n)d books", 1, n=1) == "un libre"
        i18n.ungettext("one book", "%(n)d books", 2, n=2) == "2 libres"
Exemplo n.º 2
0
    def test_ungettext_with_args(self, monkeypatch):
        self.setup_monkeypatch(monkeypatch)

        i18n.ungettext("one book", "%(n)d books", 1, n=1) == "one book"
        i18n.ungettext("one book", "%(n)d books", 2, n=2) == "2 books"

        web.ctx.lang = 'fr'
        self.d.init('fr', {
            'one book': 'un libre',
            '%(n)d books': '%(n)d libres',
        })

        i18n.ungettext("one book", "%(n)d books", 1, n=1) == "un libre"
        i18n.ungettext("one book", "%(n)d books", 2, n=2) == "2 libres"
Exemplo n.º 3
0
 def test_ungettext(self, monkeypatch):
     self.setup_monkeypatch(monkeypatch)
     
     i18n.ungettext("book", "books", 1) == "book"
     i18n.ungettext("book", "books", 2) == "books"
 
     web.ctx.lang = 'fr'
     self.d.init('fr', {
         'book': 'libre',
         'books': 'libres',
     })
     
     i18n.ungettext("book", "books", 1) == "libre"
     i18n.ungettext("book", "books", 2) == "libres"
 
     web.ctx.lang = 'te'
     i18n.ungettext("book", "books", 1) == "book"
     i18n.ungettext("book", "books", 2) == "books"
Exemplo n.º 4
0
    def test_ungettext(self, monkeypatch):
        self.setup_monkeypatch(monkeypatch)

        i18n.ungettext("book", "books", 1) == "book"
        i18n.ungettext("book", "books", 2) == "books"

        web.ctx.lang = 'fr'
        self.d.init('fr', {
            'book': 'libre',
            'books': 'libres',
        })

        i18n.ungettext("book", "books", 1) == "libre"
        i18n.ungettext("book", "books", 2) == "libres"

        web.ctx.lang = 'te'
        i18n.ungettext("book", "books", 1) == "book"
        i18n.ungettext("book", "books", 2) == "books"