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
773590dd
Commit
773590dd
authored
Oct 18, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix updating of string properties (issue #119)
parent
540fe953
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
22 deletions
+32
-22
weblate/trans/models.py
weblate/trans/models.py
+32
-22
No files found.
weblate/trans/models.py
View file @
773590dd
...
...
@@ -51,7 +51,7 @@ from weblate.lang.models import Language
from
weblate.trans.checks
import
CHECKS
from
weblate.trans.managers
import
TranslationManager
,
UnitManager
,
DictionaryManager
from
weblate.trans.filelock
import
FileLock
from
util
import
is_plural
,
split_plural
,
join_plural
,
get_target
,
is_translated
from
util
import
is_plural
,
split_plural
,
join_plural
,
get_
source
,
get_
target
,
is_translated
from
django.db.models.signals
import
post_syncdb
from
south.signals
import
post_migrate
...
...
@@ -1665,28 +1665,38 @@ class Translation(models.Model):
else
:
# Find all units with same source
for
pounit
in
store
.
findunits
(
src
):
# Does context match?
if
pounit
.
getcontext
()
==
unit
.
context
:
found
=
True
# Is it plural?
if
hasattr
(
pounit
.
target
,
'strings'
):
potarget
=
join_plural
(
pounit
.
target
.
strings
)
found_units
=
store
.
findunits
(
src
)
if
len
(
found_units
)
>
0
:
for
pounit
in
found_units
:
# Does context match?
if
pounit
.
getcontext
()
==
unit
.
context
:
# We should have only one match
found
=
True
break
else
:
# Fallback to manual find for value based files
for
pounit
in
store
.
units
:
if
get_source
(
pounit
)
==
src
:
found
=
True
break
if
found
:
# Is it plural?
if
hasattr
(
pounit
.
target
,
'strings'
):
potarget
=
join_plural
(
pounit
.
target
.
strings
)
else
:
potarget
=
pounit
.
target
# Is there any change
if
unit
.
target
!=
potarget
or
unit
.
fuzzy
!=
pounit
.
isfuzzy
():
# Update fuzzy flag
pounit
.
markfuzzy
(
unit
.
fuzzy
)
# Store translations
if
unit
.
is_plural
():
pounit
.
settarget
(
unit
.
get_target_plurals
())
else
:
potarget
=
pounit
.
target
# Is there any change
if
unit
.
target
!=
potarget
or
unit
.
fuzzy
!=
pounit
.
isfuzzy
():
# Update fuzzy flag
pounit
.
markfuzzy
(
unit
.
fuzzy
)
# Store translations
if
unit
.
is_plural
():
pounit
.
settarget
(
unit
.
get_target_plurals
())
else
:
pounit
.
settarget
(
unit
.
target
)
# We need to update backend
need_save
=
True
# We should have only one match
break
pounit
.
settarget
(
unit
.
target
)
# We need to update backend
need_save
=
True
if
not
found
:
return
False
,
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