Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Kirill Smelkov
Zope
Commits
6aaa04a1
Commit
6aaa04a1
authored
Sep 07, 2005
by
Lennart Regebro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for issue #1888 (merge from branch).
parent
8c5f35f9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
doc/CHANGES.txt
doc/CHANGES.txt
+5
-0
lib/python/TAL/TALInterpreter.py
lib/python/TAL/TALInterpreter.py
+4
-2
lib/python/TAL/tests/test_talinterpreter.py
lib/python/TAL/tests/test_talinterpreter.py
+12
-0
No files found.
doc/CHANGES.txt
View file @
6aaa04a1
...
...
@@ -58,6 +58,11 @@ Zope Changes
- DateIndex now properly removes documents from both indexes if
the value is None
- Collector #1888: Some parts of the TALInterpreter would not pass a
default when translating, yet expect a string back. This would cause
an error (usually "NoneType has no attribute 'replace'") in the case
the message was not translated.
Zope 2.8.1 (2005/08/11)
Features added
...
...
lib/python/TAL/TALInterpreter.py
View file @
6aaa04a1
...
...
@@ -531,7 +531,8 @@ class TALInterpreter:
return
if
isinstance
(
text
,
I18nMessageTypes
):
# Translate this now.
text
=
self
.
engine
.
translate
(
text
.
domain
,
text
,
text
.
mapping
)
text
=
self
.
engine
.
translate
(
text
.
domain
,
text
,
text
.
mapping
,
text
.
default
)
s
=
cgi
.
escape
(
text
)
self
.
_stream_write
(
s
)
i
=
s
.
rfind
(
'
\
n
'
)
...
...
@@ -571,8 +572,9 @@ class TALInterpreter:
# evaluate() does not do any I18n, so we do it here.
if
isinstance
(
value
,
I18nMessageTypes
):
# Translate this now.
# XXX
value
=
self
.
engine
.
translate
(
value
.
domain
,
value
,
value
.
mapping
)
value
.
mapping
,
value
.
default
)
if
not
structure
:
value
=
cgi
.
escape
(
ustr
(
value
))
...
...
lib/python/TAL/tests/test_talinterpreter.py
View file @
6aaa04a1
...
...
@@ -70,6 +70,7 @@ class I18NCornerTestCase(TestCaseBase):
self
.
engine
.
setLocal
(
'foo'
,
MessageID
(
'FoOvAlUe'
,
'default'
))
self
.
engine
.
setLocal
(
'bar'
,
'BaRvAlUe'
)
self
.
engine
.
setLocal
(
'raw'
,
'
\
t
RaW
\
n
'
)
self
.
engine
.
setLocal
(
'noxlt'
,
MessageID
(
"don't translate me"
))
def
_check
(
self
,
program
,
expected
):
result
=
StringIO
()
...
...
@@ -286,6 +287,17 @@ class I18NCornerTestCase(TestCaseBase):
"Foo <span tal:replace='bar' i18n:name='bar' /></div>"
)
self
.
_check
(
program
,
u"<div>FOO
\
u00C0
</div>
\
n
"
)
def
test_for_untranslated_messageid_simple
(
self
):
program
,
macros
=
self
.
_compile
(
'<span tal:content="noxlt"/>'
)
self
.
_check
(
program
,
"<span>don't translate me</span>
\
n
"
)
def
test_for_untranslated_messageid_i18nname
(
self
):
program
,
macros
=
self
.
_compile
(
'<div i18n:translate="" >'
'<span tal:replace="python: noxlt" i18n:name="foo_name"/>'
'</div>'
)
self
.
_check
(
program
,
"<div>don't translate me</div>
\
n
"
)
class
I18NErrorsTestCase
(
TestCaseBase
):
...
...
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