forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pedro I. Sanchez" <psanc...@colcan.biz>
Subject Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files
Date Tue, 07 Jun 2005 03:11:17 GMT
On Sun, 2005-05-06 at 14:04 +0200, Thorsten Scherler wrote:
> > This is key for me. If I cannot specify the language when I run
> > "forrest" to build my site then this is not a good solution. I guess the
> > other option would be to hard-code value="es_ES" in the above. At least
> > this would be just "one" thing hard coded :|
> > 
> 
> Yeah that would solve your usecase, but in the future that should be
> done like you suggested in your former mail.
> 
> LANG=de_DE forrest
> 
> Any thoughts, how?

I've been playing a little bit with this, and I mean "playing" indeed.
Basically trial and error since I'm not familiar with the Cocoon
machinery at all.

Anyway, first I verified that setting value="es_ES" in
main/webapp/sitemap.xmap indeed works. It brings the Spanish strings
from the right catalogue. I also verified that value="${env.LANG}" does
*not* work.

It then occurred to me that I should be able to specify the locale
string in the site's forrest.properties file. So I tested two changes:

1) First change

Index: main/forrest.build.xml
===================================================================
--- main/forrest.build.xml      (revision 180126)
+++ main/forrest.build.xml      (working copy)
@@ -104,7 +104,8 @@
     <if>
         <equals arg1="${project.i18n}" arg2="true"/>
         <then>
-          <property name="project.site-dir"
location="${project.build-dir}/site/${env.LANG}"    />
+          <property name="project.language"
location="${env.LANG}" />
+          <property name="project.site-dir"
location="${project.build-dir}/site/${project.language}"    />
         </then>
         <else>
           <property name="project.site-dir"
location="${project.build-dir}/site"    />


In my site's forrest.properties I have to add

-#project.i18n=true
+project.i18n=true
+project.language=es_ES

And this alone works just well. The site is generated under
build/site/es_ES but with English labels. The next step is
required to get the translations in place.

2) Second change: Reflecting these changes in the sitemap

Index: main/webapp/sitemap.xmap
===================================================================
--- main/webapp/sitemap.xmap    (revision 180126)
+++ main/webapp/sitemap.xmap    (working copy)
@@ -234,7 +234,7 @@
           </map:otherwise>
         </map:select>
         <map:transform type="i18n">
-          <map:parameter name="locale" value="{request:locale}"/>
+          <map:parameter name="locale" value="{project:language}"/>
              </map:transform>
       <map:serialize/>
     </map:resource>

Unfortunately these gives me a null pointer and dies :( But there's tons
of {project:xxxx} strings used everywhere in the site map! So, what's
missing to make my newly created "language" property to work?
forrest.build.xml likes it but sitemap.xmap doesn't.

What is then the right way to define a new project property?

-- 
Pedro



Mime
View raw message