Commit b60ef540 authored by Michal Čihař's avatar Michal Čihař

Allow to disable editing of monolingual template.

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent dd4907e0
...@@ -104,6 +104,8 @@ File mask ...@@ -104,6 +104,8 @@ File mask
``locale/*/LC_MESSAGES/django.po``. ``locale/*/LC_MESSAGES/django.po``.
Monolingual base language file Monolingual base language file
Base file containing strings definition for :ref:`monolingual`. Base file containing strings definition for :ref:`monolingual`.
Edit base file
Whether to allow editing of base file for :ref:`monolingual`.
Base file for new translations Base file for new translations
Base file used to generate new translations, eg. ``.pot`` file with Gettext. Base file used to generate new translations, eg. ``.pot`` file with Gettext.
File format File format
......
...@@ -14,6 +14,7 @@ Released on ? 2015. ...@@ -14,6 +14,7 @@ Released on ? 2015.
* Tuned default robots.txt to disallow big crawling of translations. * Tuned default robots.txt to disallow big crawling of translations.
* Simplified workflow for accepting suggestions. * Simplified workflow for accepting suggestions.
* Added project owners who always receive important notifications. * Added project owners who always receive important notifications.
* Allow to disable editing of monolingual template.
weblate 2.2 weblate 2.2
----------- -----------
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('trans', '0023_project_owner'),
]
operations = [
migrations.AddField(
model_name='subproject',
name='edit_template',
field=models.BooleanField(default=True, help_text='Whether users will be able to edit base file for monolingual translations.', verbose_name='Edit base file'),
preserve_default=True,
),
]
...@@ -170,6 +170,14 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin): ...@@ -170,6 +170,14 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
'for monolingual translation formats.' 'for monolingual translation formats.'
) )
) )
edit_template = models.BooleanField(
verbose_name=ugettext_lazy('Edit base file'),
default=True,
help_text=ugettext_lazy(
'Whether users will be able to edit base file '
'for monolingual translations.'
)
)
new_base = models.CharField( new_base = models.CharField(
verbose_name=ugettext_lazy('Base file for new translations'), verbose_name=ugettext_lazy('Base file for new translations'),
max_length=200, max_length=200,
...@@ -817,11 +825,14 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin): ...@@ -817,11 +825,14 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
''' '''
prefix = os.path.join(self.get_path(), '') prefix = os.path.join(self.get_path(), '')
matches = glob(os.path.join(self.get_path(), self.filemask)) matches = glob(os.path.join(self.get_path(), self.filemask))
matches = [f.replace(prefix, '') for f in matches] matches = set([f.replace(prefix, '') for f in matches])
# We want to list template among translations as well # We want to list template among translations as well
if self.has_template() and self.template not in matches: if self.has_template():
matches.append(self.template) if self.edit_template:
return matches matches.add(self.template)
else:
matches.discard(self.template)
return sorted(matches)
def create_translations(self, force=False, langs=None, request=None): def create_translations(self, force=False, langs=None, request=None):
''' '''
......
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