Skip to content

Commit

Permalink
Deps: require translate-toolkit 3.1.0
Browse files Browse the repository at this point in the history
This gets latest fixes in, including wxiki formats, JSON round trip
and dtd improvements.
  • Loading branch information
nijel committed Sep 21, 2020
1 parent f2d3235 commit f028262
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ setuptools>=36.0.1
siphashc>=1.2,<3.0
social-auth-app-django==4.0.0
social-auth-core==3.3.3
translate-toolkit>=3.0.0,<3.2.0
translate-toolkit>=3.1.0,<3.2.0
translation-finder==2.2
user-agents>=2.0,<2.3
weblate-schemas==0.4
Expand Down
6 changes: 0 additions & 6 deletions weblate/formats/tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from io import BytesIO
from unittest import SkipTest, TestCase

import translate.__version__
from django.utils.encoding import force_str
from lxml import etree
from translate.storage.po import pofile
Expand Down Expand Up @@ -470,11 +469,6 @@ class WebExtesionJSONFormatTest(JSONFormatTest):
NEW_UNIT_MATCH = b'\n "key": {\n "message": "Source string"\n }\n'
EXPECTED_FLAGS = "placeholders:$URL$"

def test_new_unit(self):
if translate.__version__.ver <= (2, 2, 5):
raise SkipTest("Broken WebExtension support in translate-toolkit")
super().test_new_unit()


class PhpFormatTest(AutoFormatTest):
FORMAT = PhpFormat
Expand Down
18 changes: 1 addition & 17 deletions weblate/formats/ttkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,16 +816,6 @@ def is_readonly(self):
class BasePoFormat(TTKitFormat, BilingualUpdateMixin):
loader = pofile

def is_valid(self):
result = super().is_valid()
if not result:
return False

# Avoid empty files with possibly syntax errors
# This can be removed once https://github.com/translate/translate/pull/3912
# is merged and relased in the Translate Toolkit
return bool(self.store.units)

def get_plural(self, language):
"""Return matching plural object."""
from weblate.lang.models import Plural
Expand Down Expand Up @@ -1331,13 +1321,7 @@ def extension():
@property
def all_store_units(self):
"""Wrapper for all store unit filtering out null."""
# The getattr is needed for translate-toolkit 3.0 and 3.1,
# once support for 3.0 is dropped, isblank can be used
return (
unit
for unit in self.store.units
if not getattr(unit, "isnull", unit.isblank)()
)
return (unit for unit in self.store.units if not unit.isblank())


class SubtitleUnit(MonolingualIDUnit):
Expand Down

0 comments on commit f028262

Please sign in to comment.