Hi,
>From: =?ISO-8859-1?Q?Jonas_Borgstr=F6m?= <jonas@edgewall.com>
>Subject: Re: [Trac] Translation in trac..
> > neo_cs is used for
> > - About.py (with the template inside, wich make it hard to translate)
> > - and the RSS files (timeline_rss.cs, ...)
> > ..and not trac.py : is it normal ?
> >
>I'm not sure I understand what you mean (except the About.py part)?
Okay, I've mistaken (and I sent this email before looking attentively at the
ClearSilver documentation : I first thought that neo_util was used for the
hdf format ;/ )
>
> > I'm evaluating the possibility to use gettext() so as to extract
> > translated text from python files and templates. Has anybody already
> > tried something like this before ?
> >
> > The other solution is to use the ClearSilver's HDF format : This
> > requires including "neo_util" in trac.py in order to manage translatable
> > templates : it's used (for only 5 variables :) in the 'netcon' demo
> > project (http://www.neomason.com/netcon/) . Any other experience in such
> > a direction ?
> >
>I think gettext is the way to go provided that it works on windows as
>well.
I aggree with you : however, I met several problems and About.py was the
typical case where I was impossible to extract gettext'ed variables as they
are all embedded in a single string.
Then I read the CS's online doc and tried the patch below wich works
perfectly for me.
The advantage of the gettext method is that it avoids to read another file
because all translated text should be compiled in a .mo file which should be
used to generate the .pyc translated file (but I must admit that I only
managed to extract gettext variables and compile the messages.po file - but
the python compiled file doesn't take care about it despite tha
--enable-gettext option used to compile CS. Maybe a problem of path, I may
ask about it on the CS list)
I've also included the "hdf-way-of-translating" philosophy in the following
files :
browser.py changeset.py file.py perm.py report.py search.py ticket.py
But I haven't tested it yet (must do it before submitting)
All this on the official 0.6.1 last version..
Ah, of course, I've a french version of all the templates (including all the
.cs files)
Does it seem good for the trac team ?
regards,
.Gilles
Index: About.py
===================================================================
--- About.py (revision 474)
+++ About.py (working copy)
@@ -33,15 +33,15 @@
<?cs include "header.cs"?>
<div id="page-content">
<div id="subheader-links">
- <a href="<?cs var:trac.href.about ?>">About Trac</a>
- | <a href="<?cs var:trac.href.about_config ?>">View Config</a>
+ <a href="<?cs var:trac.href.about ?>"><?cs var:Lang.Title ?></a>
+ | <a href="<?cs var:trac.href.about_config ?>"><?cs var:Lang.ViewConfig
?></a>
</div>
<div id="main">
<div id="main-content">
<?cs if about.page == "config"?>
- <h3>Configuration</h3>
+ <h3><?cs var:Lang.Configuration ?></h3>
<table>
- <tr><th>Section</th><th>Name</th><th>Value</th></tr>
+ <tr><?cs var:Lang.Headers ?></tr>
<?cs each:item = about.config ?>
<tr>
<td><?cs var:item.section ?></td>
@@ -53,23 +53,21 @@
<?cs else ?>
<a class="noline" href="http://trac.edgewall.com"
style="float: right"><img src="<?cs var:htdocs_location
?>trac_banner.png" alt=""/></a>
-<h1>About Trac <?cs var:trac.version ?></h1>
+<h1><?cs var:Lang.Title ?> <?cs var:trac.version ?></h1>
<p>
-Trac is a web-based software project management and bug/issue
-tracking system emphasizing ease of use and low ceremony.
-It provides an interface to the Subversion revision control systems,
integrated Wiki and convenient report facilities.
+<?cs var:Lang.Intro.1 ?>
+<?cs var:Lang.Intro.2 ?>
</p>
<p>
- Trac is distributed under the GNU General Public License (GPL).<br />
- The entire text of the license should be found in the COPYING file,
- included in the package.
+ <?cs var:Lang.License.1 ?><br />
+ <?cs var:Lang.License.2 ?>
</p>
<p>
- Please visit the Trac open source project:
+ <?cs var:Lang.PleaseVisit ?>
<a
href="http://projects.edgewall.com/trac/">http://projects.edgewall.com/trac/</a>
</p>
<p>
- Trac is a product of <a href="http://www.edgewall.com/">Edgewall
Software</a>, provider of professional Linux and software development
services.
+ <?cs var:Lang.Detail ?>
</p>
<p>
Copyright © 2003,2004 <a href="http://www.edgewall.com/">Edgewall
Software</a>
@@ -105,7 +103,8 @@
def display (self):
- cs = neo_cs.CS(self.cgi.hdf)
+ self.cgi.hdf.readFile("about.hdf")
+ cs = neo_cs.CS(self.cgi.hdf)
cs.parseStr(self.about_cs)
print "Content-type: text/html\r\n"
print cs.render()
========================= END OF THE PATCH ====================
here is the 'about.hdf' file, that should be saved in the templates
directory
==============================================================
Lang {
Title=About Trac
ViewConfig=View Config
Configuration=Configuration
Headers=<th>Section</th><th>Name</th><th>Value</th>
Intro.1=Trac is a web-based software project management and
bug/issue tracking system emphasizing ease of use and low ceremony.
Intro.2=It provides an interface to the Subversion revision control
systems, integrated Wiki and convenient report facilities.
License.1=Trac is distributed under the GNU General Public License
(GPL).
License.2=The entire text of the license should be found in the
COPYING file, included in the
package.
PleaseVisit=Please visit the Trac open source project:
Detail=Trac is a product of <a
href="http://www.edgewall.com/">Edgewall Software</a>, provider of
professional Linux and software development services.
}
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
>From: =?ISO-8859-1?Q?Jonas_Borgstr=F6m?= <jonas@edgewall.com>
>Subject: Re: [Trac] Translation in trac..
> > neo_cs is used for
> > - About.py (with the template inside, wich make it hard to translate)
> > - and the RSS files (timeline_rss.cs, ...)
> > ..and not trac.py : is it normal ?
> >
>I'm not sure I understand what you mean (except the About.py part)?
Okay, I've mistaken (and I sent this email before looking attentively at the
ClearSilver documentation : I first thought that neo_util was used for the
hdf format ;/ )
>
> > I'm evaluating the possibility to use gettext() so as to extract
> > translated text from python files and templates. Has anybody already
> > tried something like this before ?
> >
> > The other solution is to use the ClearSilver's HDF format : This
> > requires including "neo_util" in trac.py in order to manage translatable
> > templates : it's used (for only 5 variables :) in the 'netcon' demo
> > project (http://www.neomason.com/netcon/) . Any other experience in such
> > a direction ?
> >
>I think gettext is the way to go provided that it works on windows as
>well.
I aggree with you : however, I met several problems and About.py was the
typical case where I was impossible to extract gettext'ed variables as they
are all embedded in a single string.
Then I read the CS's online doc and tried the patch below wich works
perfectly for me.
The advantage of the gettext method is that it avoids to read another file
because all translated text should be compiled in a .mo file which should be
used to generate the .pyc translated file (but I must admit that I only
managed to extract gettext variables and compile the messages.po file - but
the python compiled file doesn't take care about it despite tha
--enable-gettext option used to compile CS. Maybe a problem of path, I may
ask about it on the CS list)
I've also included the "hdf-way-of-translating" philosophy in the following
files :
browser.py changeset.py file.py perm.py report.py search.py ticket.py
But I haven't tested it yet (must do it before submitting)
All this on the official 0.6.1 last version..
Ah, of course, I've a french version of all the templates (including all the
.cs files)
Does it seem good for the trac team ?
regards,
.Gilles
Index: About.py
===================================================================
--- About.py (revision 474)
+++ About.py (working copy)
@@ -33,15 +33,15 @@
<?cs include "header.cs"?>
<div id="page-content">
<div id="subheader-links">
- <a href="<?cs var:trac.href.about ?>">About Trac</a>
- | <a href="<?cs var:trac.href.about_config ?>">View Config</a>
+ <a href="<?cs var:trac.href.about ?>"><?cs var:Lang.Title ?></a>
+ | <a href="<?cs var:trac.href.about_config ?>"><?cs var:Lang.ViewConfig
?></a>
</div>
<div id="main">
<div id="main-content">
<?cs if about.page == "config"?>
- <h3>Configuration</h3>
+ <h3><?cs var:Lang.Configuration ?></h3>
<table>
- <tr><th>Section</th><th>Name</th><th>Value</th></tr>
+ <tr><?cs var:Lang.Headers ?></tr>
<?cs each:item = about.config ?>
<tr>
<td><?cs var:item.section ?></td>
@@ -53,23 +53,21 @@
<?cs else ?>
<a class="noline" href="http://trac.edgewall.com"
style="float: right"><img src="<?cs var:htdocs_location
?>trac_banner.png" alt=""/></a>
-<h1>About Trac <?cs var:trac.version ?></h1>
+<h1><?cs var:Lang.Title ?> <?cs var:trac.version ?></h1>
<p>
-Trac is a web-based software project management and bug/issue
-tracking system emphasizing ease of use and low ceremony.
-It provides an interface to the Subversion revision control systems,
integrated Wiki and convenient report facilities.
+<?cs var:Lang.Intro.1 ?>
+<?cs var:Lang.Intro.2 ?>
</p>
<p>
- Trac is distributed under the GNU General Public License (GPL).<br />
- The entire text of the license should be found in the COPYING file,
- included in the package.
+ <?cs var:Lang.License.1 ?><br />
+ <?cs var:Lang.License.2 ?>
</p>
<p>
- Please visit the Trac open source project:
+ <?cs var:Lang.PleaseVisit ?>
<a
href="http://projects.edgewall.com/trac/">http://projects.edgewall.com/trac/</a>
</p>
<p>
- Trac is a product of <a href="http://www.edgewall.com/">Edgewall
Software</a>, provider of professional Linux and software development
services.
+ <?cs var:Lang.Detail ?>
</p>
<p>
Copyright © 2003,2004 <a href="http://www.edgewall.com/">Edgewall
Software</a>
@@ -105,7 +103,8 @@
def display (self):
- cs = neo_cs.CS(self.cgi.hdf)
+ self.cgi.hdf.readFile("about.hdf")
+ cs = neo_cs.CS(self.cgi.hdf)
cs.parseStr(self.about_cs)
print "Content-type: text/html\r\n"
print cs.render()
========================= END OF THE PATCH ====================
here is the 'about.hdf' file, that should be saved in the templates
directory
==============================================================
Lang {
Title=About Trac
ViewConfig=View Config
Configuration=Configuration
Headers=<th>Section</th><th>Name</th><th>Value</th>
Intro.1=Trac is a web-based software project management and
bug/issue tracking system emphasizing ease of use and low ceremony.
Intro.2=It provides an interface to the Subversion revision control
systems, integrated Wiki and convenient report facilities.
License.1=Trac is distributed under the GNU General Public License
(GPL).
License.2=The entire text of the license should be found in the
COPYING file, included in the
package.
PleaseVisit=Please visit the Trac open source project:
Detail=Trac is a product of <a
href="http://www.edgewall.com/">Edgewall Software</a>, provider of
professional Linux and software development services.
}
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail