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
0f22d5a5
Commit
0f22d5a5
authored
Nov 29, 2013
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
48008d2d
c55c3f4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
ttkit/aresource.py
ttkit/aresource.py
+9
-2
No files found.
ttkit/aresource.py
View file @
0f22d5a5
...
...
@@ -205,7 +205,7 @@ class AndroidResourceUnit(base.TranslationUnit):
# Join the string together again, but w/o EOF marker
return
""
.
join
(
text
[:
-
1
])
def
escape
(
self
,
text
):
def
escape
(
self
,
text
,
add_quote
=
True
):
'''
Escape all the characters which need to be escaped in an Android XML file.
'''
...
...
@@ -226,7 +226,7 @@ class AndroidResourceUnit(base.TranslationUnit):
if
text
.
startswith
(
'@'
):
text
=
'
\
\
@'
+
text
[
1
:]
# Quote strings with more whitespace
if
text
[
0
]
in
WHITESPACE
or
text
[
-
1
]
in
WHITESPACE
or
len
(
MULTIWHITESPACE
.
findall
(
text
))
>
0
:
if
add_quote
and
(
text
[
0
]
in
WHITESPACE
or
text
[
-
1
]
in
WHITESPACE
or
len
(
MULTIWHITESPACE
.
findall
(
text
))
>
0
)
:
return
'"%s"'
%
text
return
text
...
...
@@ -260,6 +260,13 @@ class AndroidResourceUnit(base.TranslationUnit):
# Remove old elements
for
x
in
self
.
xmlelement
.
iterchildren
():
self
.
xmlelement
.
remove
(
x
)
# Escape all text parts
for
x
in
newstring
.
iter
():
x
.
text
=
self
.
escape
(
x
.
text
,
False
)
if
x
.
prefix
is
not
None
:
x
.
prefix
=
self
.
escape
(
x
.
prefix
,
False
)
if
x
.
tail
is
not
None
:
x
.
tail
=
self
.
escape
(
x
.
tail
,
False
)
# Add new elements
for
x
in
newstring
.
iterchildren
():
self
.
xmlelement
.
append
(
x
)
...
...
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