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
fad3a13a
Commit
fad3a13a
authored
Sep 07, 2005
by
Lennart Regebro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for issue #1888. Merge from branch for that purpose.
parent
50f43e1f
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 @
fad3a13a
...
@@ -56,6 +56,11 @@ Zope Changes
...
@@ -56,6 +56,11 @@ Zope Changes
- DateIndex now properly removes documents from both indexes if
- DateIndex now properly removes documents from both indexes if
the value is None
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)
Zope 2.8.1 (2005/08/11)
Features added
Features added
...
...
lib/python/TAL/TALInterpreter.py
View file @
fad3a13a
...
@@ -506,7 +506,8 @@ class TALInterpreter:
...
@@ -506,7 +506,8 @@ class TALInterpreter:
return
return
if
isinstance
(
text
,
MessageID
):
if
isinstance
(
text
,
MessageID
):
# Translate this now.
# Translate this now.
text
=
self
.
engine
.
translate
(
text
.
domain
,
text
,
text
.
mapping
)
text
=
self
.
engine
.
translate
(
text
.
domain
,
text
,
text
.
mapping
,
text
.
default
)
s
=
escape
(
text
)
s
=
escape
(
text
)
self
.
_stream_write
(
s
)
self
.
_stream_write
(
s
)
i
=
s
.
rfind
(
'
\
n
'
)
i
=
s
.
rfind
(
'
\
n
'
)
...
@@ -542,8 +543,9 @@ class TALInterpreter:
...
@@ -542,8 +543,9 @@ class TALInterpreter:
# evaluate() does not do any I18n, so we do it here.
# evaluate() does not do any I18n, so we do it here.
if
isinstance
(
value
,
MessageID
):
if
isinstance
(
value
,
MessageID
):
# Translate this now.
# Translate this now.
# XXX
value
=
self
.
engine
.
translate
(
value
.
domain
,
value
,
value
=
self
.
engine
.
translate
(
value
.
domain
,
value
,
value
.
mapping
)
value
.
mapping
,
value
.
default
)
if
not
structure
:
if
not
structure
:
value
=
cgi
.
escape
(
ustr
(
value
))
value
=
cgi
.
escape
(
ustr
(
value
))
...
...
lib/python/TAL/tests/test_talinterpreter.py
View file @
fad3a13a
...
@@ -70,6 +70,7 @@ class I18NCornerTestCase(TestCaseBase):
...
@@ -70,6 +70,7 @@ class I18NCornerTestCase(TestCaseBase):
self
.
engine
.
setLocal
(
'foo'
,
MessageID
(
'FoOvAlUe'
,
'default'
))
self
.
engine
.
setLocal
(
'foo'
,
MessageID
(
'FoOvAlUe'
,
'default'
))
self
.
engine
.
setLocal
(
'bar'
,
'BaRvAlUe'
)
self
.
engine
.
setLocal
(
'bar'
,
'BaRvAlUe'
)
self
.
engine
.
setLocal
(
'raw'
,
'
\
t
RaW
\
n
'
)
self
.
engine
.
setLocal
(
'raw'
,
'
\
t
RaW
\
n
'
)
self
.
engine
.
setLocal
(
'noxlt'
,
MessageID
(
"don't translate me"
))
def
_check
(
self
,
program
,
expected
):
def
_check
(
self
,
program
,
expected
):
result
=
StringIO
()
result
=
StringIO
()
...
@@ -286,6 +287,17 @@ class I18NCornerTestCase(TestCaseBase):
...
@@ -286,6 +287,17 @@ class I18NCornerTestCase(TestCaseBase):
"Foo <span tal:replace='bar' i18n:name='bar' /></div>"
)
"Foo <span tal:replace='bar' i18n:name='bar' /></div>"
)
self
.
_check
(
program
,
u"<div>FOO
\
u00C0
</div>
\
n
"
)
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
):
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