Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
b60ef540
Commit
b60ef540
authored
Mar 30, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to disable editing of monolingual template.
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
dd4907e0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
4 deletions
+38
-4
docs/admin/projects.rst
docs/admin/projects.rst
+2
-0
docs/changes.rst
docs/changes.rst
+1
-0
weblate/trans/migrations/0024_subproject_edit_template.py
weblate/trans/migrations/0024_subproject_edit_template.py
+20
-0
weblate/trans/models/subproject.py
weblate/trans/models/subproject.py
+15
-4
No files found.
docs/admin/projects.rst
View file @
b60ef540
...
@@ -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
...
...
docs/changes.rst
View file @
b60ef540
...
@@ -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
-----------
-----------
...
...
weblate/trans/migrations/0024_subproject_edit_template.py
0 → 100644
View file @
b60ef540
# -*- 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
,
),
]
weblate/trans/models/subproject.py
View file @
b60ef540
...
@@ -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
):
'''
'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment