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
47cb74ab
Commit
47cb74ab
authored
Apr 12, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent overriding pounit name
parent
c7394db7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
trans/formats.py
trans/formats.py
+16
-16
No files found.
trans/formats.py
View file @
47cb74ab
...
@@ -316,48 +316,48 @@ class FileFormat(object):
...
@@ -316,48 +316,48 @@ class FileFormat(object):
'''
'''
Finds unit by context and source.
Finds unit by context and source.
Returns tuple (
po
unit, created) indicating whether returned
Returns tuple (
ttkit_
unit, created) indicating whether returned
unit is new one.
unit is new one.
'''
'''
if
self
.
has_template
:
if
self
.
has_template
:
# Need to create new unit based on template
# Need to create new unit based on template
template_
po
unit
=
self
.
template_store
.
findid
(
context
)
template_
ttkit_
unit
=
self
.
template_store
.
findid
(
context
)
# We search by ID when using template
# We search by ID when using template
po
unit
=
self
.
store
.
findid
(
context
)
ttkit_
unit
=
self
.
store
.
findid
(
context
)
# We always need new unit to translate
# We always need new unit to translate
if
po
unit
is
None
:
if
ttkit_
unit
is
None
:
pounit
=
template_po
unit
ttkit_unit
=
template_ttkit_
unit
add
=
True
add
=
True
else
:
else
:
add
=
False
add
=
False
return
(
FileUnit
(
pounit
,
template_po
unit
),
add
)
return
(
FileUnit
(
ttkit_unit
,
template_ttkit_
unit
),
add
)
else
:
else
:
# Find all units with same source
# Find all units with same source
found_units
=
self
.
store
.
findunits
(
source
)
found_units
=
self
.
store
.
findunits
(
source
)
if
len
(
found_units
)
>
0
:
if
len
(
found_units
)
>
0
:
for
po
unit
in
found_units
:
for
ttkit_
unit
in
found_units
:
# Does context match?
# Does context match?
if
po
unit
.
getcontext
()
==
context
:
if
ttkit_
unit
.
getcontext
()
==
context
:
return
(
FileUnit
(
po
unit
),
False
)
return
(
FileUnit
(
ttkit_
unit
),
False
)
else
:
else
:
# Fallback to manual find for value based files
# Fallback to manual find for value based files
for
po
unit
in
self
.
store
.
units
:
for
ttkit_
unit
in
self
.
store
.
units
:
pounit
=
FileUnit
(
po
unit
)
ttkit_unit
=
FileUnit
(
ttkit_
unit
)
if
po
unit
.
get_source
()
==
source
:
if
ttkit_
unit
.
get_source
()
==
source
:
return
(
po
unit
,
False
)
return
(
ttkit_
unit
,
False
)
return
(
None
,
False
)
return
(
None
,
False
)
def
add_unit
(
self
,
po
unit
):
def
add_unit
(
self
,
ttkit_
unit
):
'''
'''
Adds new unit to underlaying store.
Adds new unit to underlaying store.
'''
'''
if
isinstance
(
self
.
store
,
LISAfile
):
if
isinstance
(
self
.
store
,
LISAfile
):
# LISA based stores need to know this
# LISA based stores need to know this
self
.
store
.
addunit
(
po
unit
.
unit
,
new
=
True
)
self
.
store
.
addunit
(
ttkit_
unit
.
unit
,
new
=
True
)
else
:
else
:
self
.
store
.
addunit
(
po
unit
.
unit
)
self
.
store
.
addunit
(
ttkit_
unit
.
unit
)
def
update_header
(
self
,
**
kwargs
):
def
update_header
(
self
,
**
kwargs
):
'''
'''
...
...
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