예제 #1
0
    def test_export(self):
        """Test that the export command maintains the proper plural form,
        and actually replaces an incorrect one."""
        p = self.setup_project()
        p.write_xml(data="""<resources></resources>""")
        p.write_xml(data="""<resources></resources>""", lang='ja')

        # Generate a catalog with different plural rules than we expect
        catalog = Catalog('ja')
        catalog._num_plurals, catalog._plural_expr = 2, '(n < 2)'
        p.write_po(catalog)

        # Export should override the info
        assert 'Plural-Forms header' in p.program('export')
        catalog = p.get_po('ja.po')
        assert catalog.num_plurals == 1
        assert catalog.plural_expr == '(0)'
예제 #2
0
    def test_export(self):
        """Test that the export command maintains the proper plural form,
        and actually replaces an incorrect one."""
        p = self.setup_project()
        p.write_xml(data="""<resources></resources>""")
        p.write_xml(data="""<resources></resources>""", lang='ja')

        # Generate a catalog with different plural rules than we expect
        catalog = Catalog('ja')
        catalog._num_plurals, catalog._plural_expr = 2, '(n < 2)'
        p.write_po(catalog)

        # Export should override the info
        assert 'Plural-Forms header' in p.program('export')
        catalog = p.get_po('ja.po')
        assert catalog.num_plurals == 1
        assert catalog.plural_expr == '(0)'