[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Review Request: Add extraction scripts for translatable strings
From: "Chusslove Illich" <caslav.ilic () gmx ! net>
Date: 2011-01-23 16:56:21
Message-ID: 20110123165621.29549.90739 () vidsolbach ! de
[Download RAW message or body]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/6405/#review9687
-----------------------------------------------------------
/home/kde-devel/kdesvn/trunk/KDE/kdesdk/scripts/grantlee_strings_extractor.=
py
<http://svn.reviewboard.kde.org/r/6405/#comment10828>
What is the difference between _() and i18n()? The example shows one to=
be ordinary text and the other having a placeholder, but they should be sy=
nonyms. =
=
Since _() is native Gettext convention, other synonyms in the same vein=
would be p_() for i18nc(), n_() for i18np(), and pn_() for i18ncp().
=
(Just to be sure, are translations fetched later really through KDE i18=
n calls? Only then should calls have i18n*() names.)
=
/home/kde-devel/kdesvn/trunk/KDE/kdesdk/scripts/grantlee_strings_extractor.=
py
<http://svn.reviewboard.kde.org/r/6405/#comment10829>
Is it guaranteed that the order of messages in the output file is exact=
ly the same as the order in the template file?
/home/kde-devel/kdesvn/trunk/KDE/kdesdk/scripts/grantlee_strings_extractor.=
py
<http://svn.reviewboard.kde.org/r/6405/#comment10830>
The line number in the template file should also be recorded for each e=
xtracted message, so that this comment can be
=
// i18n: file: <filename>:<line>
=
/home/kde-devel/kdesvn/trunk/KDE/kdesdk/scripts/grantlee_strings_extractor.=
py
<http://svn.reviewboard.kde.org/r/6405/#comment10831>
This means that first the shell will glob the arguments, and then the s=
cript will glob for the second time? Now that's weird :)
- Chusslove
On Jan. 23, 2011, 1:24 p.m., Stephen Kelly wrote:
> =
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/6405/
> -----------------------------------------------------------
> =
> (Updated Jan. 23, 2011, 1:24 p.m.)
> =
> =
> Review request for kdelibs, Pino Toscano and Chusslove Illich.
> =
> =
> Summary
> -------
> =
> The new scripts allow the kde i18n infrastructure to extract translatable=
strings from Grantlee templates.
> =
> An additional line is needed in the Messages.sh script
> =
> =
> Diffs
> -----
> =
> /home/kde-devel/kdesvn/trunk/KDE/kdesdk/scripts/grantlee_strings_extrac=
tor.py PRE-CREATION =
> =
> Diff: http://svn.reviewboard.kde.org/r/6405/diff
> =
> =
> Testing
> -------
> =
> Works locally. The code in playground/pim/contacts can be used to test th=
is with x-test once it's checked in.
> =
> =
> Thanks,
> =
> Stephen
> =
>
[Attachment #3 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://svn.reviewboard.kde.org/r/6405/">http://svn.reviewboard.kde.org/r/6405/</a>
</td>
</tr>
</table>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://svn.reviewboard.kde.org/r/6405/diff/2/?file=44441#file44441line107" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/home/kde-devel/kdesvn/trunk/KDE/kdesdk/scripts/grantlee_strings_extractor.py</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">107</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="c"># This is a {{ _("translatable string") }} in the \
template.</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">What is the \
difference between _() and i18n()? The example shows one to be ordinary text and the \
other having a placeholder, but they should be synonyms.
Since _() is native Gettext convention, other synonyms in the same vein would be p_() \
for i18nc(), n_() for i18np(), and pn_() for i18ncp().
(Just to be sure, are translations fetched later really through KDE i18n calls? Only \
then should calls have i18n*() names.) </pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://svn.reviewboard.kde.org/r/6405/diff/2/?file=44441#file44441line358" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/home/kde-devel/kdesvn/trunk/KDE/kdesdk/scripts/grantlee_strings_extractor.py</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">358</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">for</span> <span class="n">token</span> <span class="ow">in</span> <span \
class="n">tokenize</span><span class="p">(</span><span \
class="n">template_string</span><span class="p">):</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Is it \
guaranteed that the order of messages in the output file is exactly the same as the \
order in the template file?</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://svn.reviewboard.kde.org/r/6405/diff/2/?file=44441#file44441line368" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/home/kde-devel/kdesvn/trunk/KDE/kdesdk/scripts/grantlee_strings_extractor.py</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">368</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="n">outputfile</span><span class="o">.</span><span \
class="n">write</span><span class="p">(</span><span class="s">"// i18n: file: \
"</span> <span class="o">+</span> <span class="n">template_filename</span> <span \
class="o">+</span> <span class="s">"</span><span class="se">\n</span><span \
class="s">"</span><span class="p">)</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The line \
number in the template file should also be recorded for each extracted message, so \
that this comment can be
// i18n: file: <filename>:<line>
</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://svn.reviewboard.kde.org/r/6405/diff/2/?file=44441#file44441line386" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/home/kde-devel/kdesvn/trunk/KDE/kdesdk/scripts/grantlee_strings_extractor.py</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">386</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">files</span> <span class="o">=</span> <span class="nb">reduce</span><span \
class="p">(</span><span class="n">operator</span><span class="o">.</span><span \
class="n">add</span><span class="p">,</span> <span class="nb">map</span><span \
class="p">(</span><span class="n">glob</span><span class="o">.</span><span \
class="n">glob</span><span class="p">,</span> <span class="n">sys</span><span \
class="o">.</span><span class="n">argv</span><span class="p">[</span><span \
class="mi">1</span><span class="p">:]))</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This means \
that first the shell will glob the arguments, and then the script will glob for the \
second time? Now that's weird :)</pre> </div>
<br />
<p>- Chusslove</p>
<br />
<p>On January 23rd, 2011, 1:24 p.m., Stephen Kelly wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://svn.reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for kdelibs, Pino Toscano and Chusslove Illich.</div>
<div>By Stephen Kelly.</div>
<p style="color: grey;"><i>Updated Jan. 23, 2011, 1:24 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">The new scripts allow the kde i18n infrastructure to extract \
translatable strings from Grantlee templates.
An additional line is needed in the Messages.sh script</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Works locally. The code in playground/pim/contacts can be used to test \
this with x-test once it's checked in.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/home/kde-devel/kdesvn/trunk/KDE/kdesdk/scripts/grantlee_strings_extractor.py \
<span style="color: grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="http://svn.reviewboard.kde.org/r/6405/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic