Commit 9d348061 authored by Michal Čihař's avatar Michal Čihař

Proper handling of bilingual json files (issue #488)

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent bbf7be85
......@@ -27,6 +27,7 @@ from translate.storage.xliff import xliffunit
from translate.storage.po import pounit, pofile
from translate.storage.php import phpunit
from translate.storage.ts2 import tsunit
from translate.storage.jsonl10n import JsonUnit
from translate.storage import mo
from translate.storage import factory
from weblate.trans.util import get_string, join_plural
......@@ -158,6 +159,8 @@ class FileUnit(object):
self.unit.source,
self.unit.source,
])
if isinstance(self.mainunit, JsonUnit) and self.template is None:
return self.mainunit.getid().lstrip('.')
if self.is_unit_key_value():
# Need to decode property encoded string
if isinstance(self.mainunit, propunit):
......@@ -296,6 +299,8 @@ class FileUnit(object):
For some reason, blank string does not mean non translatable
unit in some formats (XLIFF), so lets skip those as well.
'''
if isinstance(self.mainunit, JsonUnit):
return True
return self.mainunit.istranslatable() and not self.mainunit.isblank()
def set_target(self, target):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment