Commit 248b9dcc authored by Michal Čihař's avatar Michal Čihař

USe generic names for helper classes

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent fc1158c7
...@@ -345,16 +345,15 @@ class FileUnit(object): ...@@ -345,16 +345,15 @@ class FileUnit(object):
self.unit.markfuzzy(fuzzy) self.unit.markfuzzy(fuzzy)
class TSUnit(FileUnit): class MonolingualIDUnit(FileUnit):
def get_context(self): def get_context(self):
if self.template is not None: if self.template is not None:
# Monolingual JSON files
return self.template.getid() return self.template.getid()
else: else:
return self.mainunit.getcontext() return self.mainunit.getcontext()
class JSONUnit(FileUnit): class MonolingualSimpleUnit(MonolingualIDUnit):
def get_locations(self): def get_locations(self):
return '' return ''
...@@ -363,13 +362,6 @@ class JSONUnit(FileUnit): ...@@ -363,13 +362,6 @@ class JSONUnit(FileUnit):
return self.mainunit.getid().lstrip('.') return self.mainunit.getid().lstrip('.')
return get_string(self.template.target) return get_string(self.template.target)
def get_context(self):
if self.template is not None:
# Monolingual JSON files
return self.template.getid()
else:
return self.mainunit.getcontext()
def is_translatable(self): def is_translatable(self):
return True return True
...@@ -889,7 +881,7 @@ class TSFormat(FileFormat): ...@@ -889,7 +881,7 @@ class TSFormat(FileFormat):
format_id = 'ts' format_id = 'ts'
loader = ('ts2', 'tsfile') loader = ('ts2', 'tsfile')
autoload = ('.ts',) autoload = ('.ts',)
unit_class = TSUnit unit_class = MonolingualIDUnit
@register_fileformat @register_fileformat
...@@ -1046,7 +1038,7 @@ class JSONFormat(FileFormat): ...@@ -1046,7 +1038,7 @@ class JSONFormat(FileFormat):
name = _('JSON file') name = _('JSON file')
format_id = 'json' format_id = 'json'
loader = ('weblate.trans.aresource', 'JsonFile') loader = ('weblate.trans.aresource', 'JsonFile')
unit_class = JSONUnit unit_class = MonolingualSimpleUnit
autoload = ('.json',) autoload = ('.json',)
@classmethod @classmethod
...@@ -1086,7 +1078,7 @@ class CSVFormat(FileFormat): ...@@ -1086,7 +1078,7 @@ class CSVFormat(FileFormat):
name = _('CSV file') name = _('CSV file')
format_id = 'csv' format_id = 'csv'
loader = ('csvl10n', 'csvfile') loader = ('csvl10n', 'csvfile')
unit_class = JSONUnit unit_class = MonolingualSimpleUnit
autoload = ('.csv',) autoload = ('.csv',)
@property @property
......
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