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
ffc587f5
Commit
ffc587f5
authored
Aug 21, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove explicit transaction handling
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
8805669d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
48 deletions
+46
-48
weblate/lang/models.py
weblate/lang/models.py
+46
-48
No files found.
weblate/lang/models.py
View file @
ffc587f5
...
...
@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from
django.db
import
models
,
transaction
from
django.db
import
models
from
django.utils.translation
import
ugettext
as
_
from
django.utils.safestring
import
mark_safe
from
translate.lang.data
import
languages
...
...
@@ -190,62 +190,60 @@ class LanguageManager(models.Manager):
# Languages from ttkit
for
code
,
props
in
languages
.
items
():
with
transaction
.
commit_on_success
():
lang
,
created
=
Language
.
objects
.
get_or_create
(
code
=
code
)
lang
,
created
=
Language
.
objects
.
get_or_create
(
code
=
code
)
# Should we update existing?
if
not
update
and
not
created
:
continue
# Should we update existing?
if
not
update
and
not
created
:
continue
# Set language name
lang
.
name
=
props
[
0
].
split
(
';'
)[
0
]
lang
.
fixup_name
()
# Set language name
lang
.
name
=
props
[
0
].
split
(
';'
)[
0
]
lang
.
fixup_name
()
# Set number of plurals and equation
lang
.
nplurals
=
props
[
1
]
lang
.
pluralequation
=
props
[
2
].
strip
(
';'
)
lang
.
fixup_plurals
()
# Set number of plurals and equation
lang
.
nplurals
=
props
[
1
]
lang
.
pluralequation
=
props
[
2
].
strip
(
';'
)
lang
.
fixup_plurals
()
# Set language direction
lang
.
set_direction
()
# Set language direction
lang
.
set_direction
()
# Get plural type
lang
.
plural_type
=
get_plural_type
(
lang
.
code
,
lang
.
pluralequation
)
# Get plural type
lang
.
plural_type
=
get_plural_type
(
lang
.
code
,
lang
.
pluralequation
)
# Save language
lang
.
save
()
# Save language
lang
.
save
()
# Create Weblate extra languages
for
props
in
data
.
EXTRALANGS
:
with
transaction
.
commit_on_success
():
lang
,
created
=
Language
.
objects
.
get_or_create
(
code
=
props
[
0
]
)
# Should we update existing?
if
not
update
and
not
created
:
continue
lang
.
name
=
props
[
1
]
lang
.
nplurals
=
props
[
2
]
lang
.
pluralequation
=
props
[
3
]
if
props
[
0
]
in
data
.
RTL_LANGS
:
lang
.
direction
=
'rtl'
else
:
lang
.
direction
=
'ltr'
# Get plural type
lang
.
plural_type
=
get_plural_type
(
lang
.
code
,
lang
.
pluralequation
)
lang
.
save
()
lang
,
created
=
Language
.
objects
.
get_or_create
(
code
=
props
[
0
]
)
# Should we update existing?
if
not
update
and
not
created
:
continue
lang
.
name
=
props
[
1
]
lang
.
nplurals
=
props
[
2
]
lang
.
pluralequation
=
props
[
3
]
if
props
[
0
]
in
data
.
RTL_LANGS
:
lang
.
direction
=
'rtl'
else
:
lang
.
direction
=
'ltr'
# Get plural type
lang
.
plural_type
=
get_plural_type
(
lang
.
code
,
lang
.
pluralequation
)
lang
.
save
()
def
have_translation
(
self
):
'''
...
...
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