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
caa80c71
Commit
caa80c71
authored
Jul 13, 2004
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for issue 233 in the Zope 3 collector.
This corresponds to the Hotfix_2004-07-13 product.
parent
f606e849
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
42 additions
and
20 deletions
+42
-20
lib/python/Products/PageTemplates/tests/output/CheckI18nTranslateHooked.html
.../PageTemplates/tests/output/CheckI18nTranslateHooked.html
+1
-1
lib/python/TAL/TALDefs.py
lib/python/TAL/TALDefs.py
+1
-1
lib/python/TAL/TALGenerator.py
lib/python/TAL/TALGenerator.py
+4
-4
lib/python/TAL/TALInterpreter.py
lib/python/TAL/TALInterpreter.py
+10
-3
lib/python/TAL/tests/input/test36.html
lib/python/TAL/tests/input/test36.html
+6
-0
lib/python/TAL/tests/output/test36.html
lib/python/TAL/tests/output/test36.html
+2
-0
lib/python/TAL/tests/test_htmltalparser.py
lib/python/TAL/tests/test_htmltalparser.py
+15
-9
lib/python/TAL/tests/test_talinterpreter.py
lib/python/TAL/tests/test_talinterpreter.py
+3
-2
No files found.
lib/python/Products/PageTemplates/tests/output/CheckI18nTranslateHooked.html
View file @
caa80c71
...
...
@@ -4,7 +4,7 @@
<p>
[foo](bar/{})
</p>
<a
href=
"foo"
alt=
"[default](alttext/{})"
>
link
</a>
<p>
[dom](${name} was born in ${country}./{'country':'Antarctica','name':'Lomax'})
</p>
<p>
[default](hmm/{'age':
25
})
</p>
<p>
[default](hmm/{'age':
'25'
})
</p>
</head>
</body>
</html>
lib/python/TAL/TALDefs.py
View file @
caa80c71
...
...
@@ -19,7 +19,7 @@ from types import ListType, TupleType
from
ITALES
import
ITALESErrorInfo
TAL_VERSION
=
"1.
4
"
TAL_VERSION
=
"1.
5
"
XML_NS
=
"http://www.w3.org/XML/1998/namespace"
# URI for XML namespace
XMLNS_NS
=
"http://www.w3.org/2000/xmlns/"
# URI for XML NS declarations
...
...
lib/python/TAL/TALGenerator.py
View file @
caa80c71
...
...
@@ -352,9 +352,8 @@ class TALGenerator:
assert
action
==
I18N_EXPRESSION
key
,
expr
=
parseSubstitution
(
expression
)
cexpr
=
self
.
compileExpression
(
expr
)
# XXX Would key be anything but 'text' or None?
assert
key
in
(
'text'
,
None
)
self
.
emit
(
'i18nVariable'
,
varname
,
program
,
cexpr
)
self
.
emit
(
'i18nVariable'
,
varname
,
program
,
cexpr
,
int
(
key
==
"structure"
))
def
emitTranslation
(
self
,
msgid
,
i18ndata
):
program
=
self
.
popProgram
()
...
...
@@ -783,7 +782,8 @@ class TALGenerator:
# - I18N_CONTENT for tal:content
# - I18N_EXPRESSION for explicit tal:replace
# o varname[2] will be None for the first two actions and the
# replacement tal expression for the third action.
# replacement tal expression for the third action. This
# can include a 'text' or 'structure' indicator.
assert (varname[1]
in [I18N_REPLACE, I18N_CONTENT, I18N_EXPRESSION])
self.emitI18nVariable(varname)
...
...
lib/python/TAL/TALInterpreter.py
View file @
caa80c71
...
...
@@ -14,7 +14,7 @@
"""
Interpreter for a pre-compiled TAL program.
"""
import
cgi
import
sys
import
getopt
import
re
...
...
@@ -496,7 +496,7 @@ class TALInterpreter:
bytecode_handlers
[
"insertText"
]
=
do_insertText
def
do_i18nVariable
(
self
,
stuff
):
varname
,
program
,
expression
=
stuff
varname
,
program
,
expression
,
structure
=
stuff
if
expression
is
None
:
# The value is implicitly the contents of this tag, so we have to
# evaluate the mini-program to get the value of the variable.
...
...
@@ -510,7 +510,14 @@ class TALInterpreter:
else
:
# Evaluate the value to be associated with the variable in the
# i18n interpolation dictionary.
if
structure
:
value
=
self
.
engine
.
evaluateStructure
(
expression
)
else
:
value
=
self
.
engine
.
evaluate
(
expression
)
if
not
structure
:
value
=
cgi
.
escape
(
str
(
value
))
# Either the i18n:name tag is nested inside an i18n:translate in which
# case the last item on the stack has the i18n dictionary and string
# representation, or the i18n:name and i18n:translate attributes are
...
...
lib/python/TAL/tests/input/test36.html
0 → 100644
View file @
caa80c71
<span
tal:replace=
"string:<foo>"
/>
<span
i18n:translate=
""
>
<span
tal:replace=
"string:<foo>"
i18n:name=
"name1"
/>
<span
tal:replace=
"structure string:<bar />"
i18n:name=
"name2"
/>
<span
i18n:name=
"name3"
><b>
some
</b>
<i>
text
</i></span>
</span>
lib/python/TAL/tests/output/test36.html
0 → 100644
View file @
caa80c71
<
foo
>
<span>
<
foo
>
<bar
/>
<b>
some
</b>
<i>
text
</i></span>
lib/python/TAL/tests/test_htmltalparser.py
View file @
caa80c71
...
...
@@ -594,7 +594,8 @@ translated string</span>
(
'span'
,
[(
'tal:replace'
,
'str:Lomax'
,
'tal'
),
(
'i18n:name'
,
'name'
,
'i18n'
)]))],
'$str:Lomax$'
)),
'$str:Lomax$'
,
0
)),
(
'rawtextBeginScope'
,
(
' was born in
\
n
'
,
2
,
...
...
@@ -607,7 +608,8 @@ translated string</span>
(
'span'
,
[(
'tal:replace'
,
'str:Antarctica'
,
'tal'
),
(
'i18n:name'
,
'country'
,
'i18n'
)]))],
'$str:Antarctica$'
)),
'$str:Antarctica$'
,
0
)),
(
'endScope'
,
()),
(
'rawtextColumn'
,
(
'.
\
n
'
,
0
))])),
(
'endScope'
,
()),
...
...
@@ -638,7 +640,8 @@ translated string</span>
(
''
,
[(
'insertText'
,
(
'$bar$'
,
[]))])),
(
'rawtextOffset'
,
(
'</span>'
,
7
))],
None
)),
None
,
0
)),
(
'endScope'
,
()),
(
'rawtextOffset'
,
(
'.'
,
1
))])),
(
'endScope'
,
()),
...
...
@@ -662,12 +665,12 @@ translated string</span>
[(
'rawtextBeginScope'
,
(
'
\
n
'
,
2
,
(
2
,
2
),
0
,
{
'i18n:name'
:
'name'
})),
(
'i18nVariable'
,
(
'name'
,
[(
'rawtextOffset'
,
(
'<b>Jim</b>'
,
10
))],
None
)),
[(
'rawtextOffset'
,
(
'<b>Jim</b>'
,
10
))],
None
,
0
)),
(
'rawtextBeginScope'
,
(
' was born in
\
n
'
,
2
,
(
3
,
2
),
1
,
{
'i18n:name'
:
'country'
})),
(
'i18nVariable'
,
(
'country'
,
[(
'rawtextOffset'
,
(
'the USA'
,
7
))],
None
)),
[(
'rawtextOffset'
,
(
'the USA'
,
7
))],
None
,
0
)),
(
'endScope'
,
()),
(
'rawtextColumn'
,
(
'.
\
n
'
,
0
))])),
(
'endScope'
,
()),
...
...
@@ -782,7 +785,7 @@ translated string</span>
[(
'i18n:data'
,
'here/currentTime'
,
'i18n'
),
(
'i18n:translate'
,
'timefmt'
,
'i18n'
),
(
'i18n:name'
,
'time'
,
'i18n'
)])),
(
'i18nVariable'
,
(
'time'
,
[],
None
))],
(
'i18nVariable'
,
(
'time'
,
[],
None
,
0
))],
'$here/currentTime$'
)),
(
'endScope'
,
()),
(
'rawtextOffset'
,
(
'... beep!'
,
9
))])),
...
...
@@ -816,7 +819,8 @@ translated string</span>
(
'i18n:name'
,
'jobnum'
,
'i18n'
)])),
(
'rawtextOffset'
,
(
'NN'
,
2
)),
(
'rawtextOffset'
,
(
'</span>'
,
7
))],
'$context/@@object_name$'
)),
'$context/@@object_name$'
,
0
)),
(
'endScope'
,
())])),
(
'endScope'
,
()),
(
'rawtextColumn'
,
(
'</span>
\
n
'
,
0
))
...
...
@@ -860,7 +864,8 @@ translated string</span>
[(
'rawtextOffset'
,
(
'user@host.com'
,
13
))])),
(
'endScope'
,
()),
(
'rawtextOffset'
,
(
'</a>'
,
4
))],
None
)),
None
,
0
)),
(
'endScope'
,
()),
(
'rawtextColumn'
,
(
'
\
n
'
,
0
))])),
(
'endScope'
,
()),
...
...
@@ -900,7 +905,8 @@ translated string</span>
(
'$request/submitter$'
,
[(
'rawtextOffset'
,
(
'user@host.com'
,
13
))])),
(
'rawtextOffset'
,
(
'</a>'
,
4
))],
None
)),
None
,
0
)),
(
'endScope'
,
()),
(
'rawtextColumn'
,
(
'
\
n
'
,
0
))])),
(
'endScope'
,
()),
...
...
lib/python/TAL/tests/test_talinterpreter.py
View file @
caa80c71
...
...
@@ -94,7 +94,7 @@ class I18NCornerTestCase(TestCaseBase):
'<div>THIS IS TEXT FOR <span>BARVALUE</span>.</div>
\
n
'
)
def
test_translate_static_text_as_dynamic_from_bytecode
(
self
):
program
=
[(
'version'
,
'1.
4
'
),
program
=
[(
'version'
,
'1.
5
'
),
(
'mode'
,
'html'
),
(
'setPosition'
,
(
1
,
0
)),
(
'beginScope'
,
{
'i18n:translate'
:
''
}),
...
...
@@ -116,7 +116,8 @@ class I18NCornerTestCase(TestCaseBase):
(
''
,
[(
'insertText'
,
(
'$bar$'
,
[]))])),
(
'rawtextOffset'
,
(
'</span>'
,
7
))],
None
)),
None
,
0
)),
(
'endScope'
,
()),
(
'rawtextOffset'
,
(
'.'
,
1
))])),
(
'endScope'
,
()),
...
...
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