Mailing List Archive

Translation in trac..
Hi,

I'm trying to translate trac with the gettext extension available in
Clearsilver since the 0.9.8 version.
Some explanations can also be found here :
http://article.gmane.org/gmane.text.clearsilver.general/53

It seems that actually the clearsilver's way to manage templates is not very
used :
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 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
?

.G. Vincent

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus
Translation in trac.. [ In reply to ]
Gilles Vincent wrote:
> Hi,
>
Hi Gilles,

> I'm trying to translate trac with the gettext extension available in
> Clearsilver since the 0.9.8 version.
> Some explanations can also be found here :
> http://article.gmane.org/gmane.text.clearsilver.general/53
>
> It seems that actually the clearsilver's way to manage templates is not
> very used :
> 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)?

> 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.

/ Jonas
--
Jonas Borgstr?m | Edgewall Software
jonas@edgewall.com | Professional GNU/Linux & Open Source Consulting.
| http://www.edgewall.com/
Translation in trac.. [ In reply to ]
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 (with the corresponding .hdf file : see below).
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>&nbsp;
- | <a href="<?cs var:trac.href.about_config ?>">View Config</a>&nbsp;
+ <a href="<?cs var:trac.href.about ?>"><?cs var:Lang.Title ?></a>&nbsp;
+ | <a href="<?cs var:trac.href.about_config ?>"><?cs var:Lang.ViewConfig
?></a>&nbsp;
</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 &copy; 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:&nbsp;
Detail=Trac is a product of <a
href="http://www.edgewall.com/">Edgewall Software</a>, provider of
professional Linux and software development services.
}

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
Translation in trac.. [ In reply to ]
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 (with the corresponding .hdf file : see below).
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>&nbsp;
- | <a href="<?cs var:trac.href.about_config ?>">View Config</a>&nbsp;
+ <a href="<?cs var:trac.href.about ?>"><?cs var:Lang.Title ?></a>&nbsp;
+ | <a href="<?cs var:trac.href.about_config ?>"><?cs var:Lang.ViewConfig
?></a>&nbsp;
</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 &copy; 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:&nbsp;
Detail=Trac is a product of <a
href="http://www.edgewall.com/">Edgewall Software</a>, provider of
professional Linux and software development services.
}

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
Translation in trac.. [ In reply to ]
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 (with the corresponding .hdf file : see below).

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 (I must do it before submitting, no ? :)

All this on the official 0.6.1 version of Trac
Ah, I've forgotten, I've a french version of each template (including all
the .cs files)

Does it seems good for the trac team ?
Should I look more in the "gettext" way ?

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>&nbsp;
- | <a href="<?cs var:trac.href.about_config ?>">View Config</a>&nbsp;
+ <a href="<?cs var:trac.href.about ?>"><?cs var:Lang.Title ?></a>&nbsp;
+ | <a href="<?cs var:trac.href.about_config ?>"><?cs var:Lang.ViewConfig
?></a>&nbsp;
</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 &copy; 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:&nbsp;
Detail=Trac is a product of <a
href="http://www.edgewall.com/">Edgewall Software</a>, provider of
professional Linux and software development services.
}

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail