You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Thorsten Scherler <th...@apache.org> on 2005/06/04 23:49:49 UTC

Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

On Sat, 2005-06-04 at 21:36 +0100, Ross Gardler wrote:
> Pedro I. Sanchez wrote:
> > On Sat, 2005-04-06 at 06:06 +0200, Thorsten Scherler (JIRA) wrote:
> > 
> >>    [ http://issues.apache.org/jira/browse/FOR-506?page=comments#action_12312612 ] 
> >>
> >>Thorsten Scherler commented on FOR-506:
> >>---------------------------------------
> >>
> 
> ...
> 
> >>So what we need is that 
> >>1) we surround all captions with <i18n:text /> tags
> >>2) add this keys to the catalogue
> > 
> > 
> > Where is the catalogue where I need to add the keys/values to?
> 
> They are attached to the issue in the patch that Thorsten uploaded.
> 
> Ross

In revision 180026 I added (I applied the patch to trunk):
main/webapp/skins/common/messages/CommonMessages_es.xml
main/webapp/skins/common/messages/CommonMessages_de.xml
main/webapp/skins/common/messages/CommonMessages_us.xml

That are the catalogues.

I guess the work should start in creating one master 
main/webapp/skins/common/messages/CommonMessages_us.xml
and add all skin keys to it. Then
cp main/webapp/skins/common/messages/CommonMessages_us.xml
main/webapp/skins/common/messages/CommonMessages_{language_country_variant}.xml

and translate the keys.

HTH

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by Juan Jose Pablos <ch...@apache.org>.
Pedro I. Sanchez wrote:
> It simply doesn't work for me. I'm running Debian 3.1 with Java 1.4.2
> from Blackdown. 

I am using same setup except this:

cheche@yarel:~$ java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

 > (English site is generated under build/site/en)

this gives me the impresion that the JVM is not getting the right locale.


> Could it be that I need to use another JVM? from SUN probably?
> 

give it a try. It seems that should be the issue.

Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by "Pedro I. Sanchez" <ps...@colcan.biz>.
It simply doesn't work for me. I'm running Debian 3.1 with Java 1.4.2
from Blackdown. Working with Forrest SVN at revision 189975. In an empty
directory:

$forrest seed
$forrest

(English site is generated under build/site/)

$ export LANG=es_ES
$ echo $LANG
es_ES

(edit forrest.properties to uncomment project.i18n=true)

$ forrest clean
$ forrest

(English site is generated under build/site/en)

So my conclusions are still the same: Following the introduction of
user.language in trunk, when I enable the i18n option in
forrest.properties, 

1. My static site is always generated under build/site/en, and this
regardless of my language settings. This was working well before (my
site was generated under build/site/es when LANG=es_ES).

2. "Last Published:" is never rendered in Spanish. I don't know if other
labels are supposed to change as well but I can tell I get an
all-English sample site.

Item 2 has never worked for me in the past, except when I force the line

  <map:parameter name="locale" value="es_ES"/>

in sitemap.xmap.

Could it be that I need to use another JVM? from SUN probably?

-- 
Pedro

PS. BTW I noticed that SVN revision 189975 fails to build in its
entirety. I will send a separate e-mail about this.



Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by Juan Jose Pablos <ch...@apache.org>.
Pedro I. Sanchez wrote:
>>I can not reproduce this. "Forrest site" works for me.
>>
> 
> Are you on Linux or Windows?

debian 3.1

> I don't understand. How can it work for you?

how can it does not work for you?

> This line in sitemap.xmap is the one that determines the catalogue to
> use and as you can see it is not connected at all with the LANG
> environment variable.
no, I do not see why are you making this up.

> 
> <map:parameter name="locale" value="{request:locale}"/>
> 
> It is connected instead to the language selection of your browser which
> doesn't help much with a static site.

Why are you making that statement without knowledge of how it works?
Locale is determined based on diferent parameters with an order, not 
just that one.

>>have you try to issue "export LANG=es" ??????? I think that I told you 
>>before.
>>
> 
> It's the same. In both cases the execution environment has the variable
> LANG set to the proper value. Anyhow, I tested using the "export" with
> the same results.
> 


> Can you explain why you think 'user.language' does anything when it is
> not defined in forrest.build.xml?
> 

Because is part of the JVM properties and it will define the server 
default language use. So when you try to build a static site the VM 
default locale is used.


Possibly we need to look into the CLI to find out a better way to do 
that, ok, but today that know this can work.

I made some notes here:
http://casa.che-che.com/blog/2005/05/10/internalization-a-site-using-forrest-07-dev/

if that does not work for you then it is something that is not quite 
right on your enviroment/test


Cheers,
cheche





Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by "Pedro I. Sanchez" <ps...@colcan.biz>.
On Thu, 2005-09-06 at 12:56 +0200, Juan Jose Pablos wrote:
> Pedro I. Sanchez wrote:
> > The string $(env.LANG} works well inside main/forrest.build.xml. It was
> > the default before you made changes to the trunk. But the same string is
> > ignored when you use it inside webapp/sitemap.xmap (skin labels are
> > looked up in the English dictionary, even if LANG=es_ES).
> > 
> 
> are you talking about tabs and menus or are you talking about "Last 
> Published:"
> 
Last Published:

> > 
> > I don't believe what you did is right, sorry if I misunderstand :|
> > You replaced my 'project.language' with 'user.language' but you are not
> > defining 'user.language' in forrest.build.xml. So it does nothing when I
> > use it in my site's 'forrest.properties'.
> > 
> is using the default language for the JVM. In the case of the windows 
> machines, that will work much better. This change only affect the 
> creation of a directory base on the language..
> 
> 
> This way you can run "export LANG=en" "forrest site" "export LANG=es" 
> "forrest site"
> 
> so diferent languages goes to diferent directories.
> 
As I said that used to work before your changes; it doesn't work now for
me. You removed the reference to $(env.LANG} in favour of user.language
(which I believe is doing nothing).

Before:

location="${project.build-dir}/site/${env.LANG}"

With your changes:

location="${project.build-dir}/site/${user.language}" 

> > 
> > 
> > So, let me rephrase my understanding of this issue so far. Before you
> > made changes to trunk this was the behaviour:
> > 
> > 1. Forrest seed; forrest would generate the static site in English,
> > regardless of your LANG env.
> > 
> sure. There is not implementation to seed a project with examples in 
> spanish..
> 
> 
> 
> > 2. Setting project.i18n=true in forrest.properties and running forrest
> > again would generate your site in build/site/xx, where xx is determined
> > by the LANG env. BUT, the generated static site is still all in English;
> > no look up into the language-specific catalogues ever takes place.
> > 
> 
> I can not reproduce this. "Forrest site" works for me.
> 
Are you on Linux or Windows?
I don't understand. How can it work for you?
This line in sitemap.xmap is the one that determines the catalogue to
use and as you can see it is not connected at all with the LANG
environment variable.

<map:parameter name="locale" value="{request:locale}"/>

It is connected instead to the language selection of your browser which
doesn't help much with a static site.


> > My goal for a static site is to be able to issue the command
> > 
> > $ LANG=es_ES forrest
> > 
> have you try to issue "export LANG=es" ??????? I think that I told you 
> before.
> 
It's the same. In both cases the execution environment has the variable
LANG set to the proper value. Anyhow, I tested using the "export" with
the same results.

Can you explain why you think 'user.language' does anything when it is
not defined in forrest.build.xml?

-- 
Pedro



Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by Juan Jose Pablos <ch...@apache.org>.
Pedro I. Sanchez wrote:
> The string $(env.LANG} works well inside main/forrest.build.xml. It was
> the default before you made changes to the trunk. But the same string is
> ignored when you use it inside webapp/sitemap.xmap (skin labels are
> looked up in the English dictionary, even if LANG=es_ES).
> 

are you talking about tabs and menus or are you talking about "Last 
Published:"

> 
> I don't believe what you did is right, sorry if I misunderstand :|
> You replaced my 'project.language' with 'user.language' but you are not
> defining 'user.language' in forrest.build.xml. So it does nothing when I
> use it in my site's 'forrest.properties'.
> 
is using the default language for the JVM. In the case of the windows 
machines, that will work much better. This change only affect the 
creation of a directory base on the language..


This way you can run "export LANG=en" "forrest site" "export LANG=es" 
"forrest site"

so diferent languages goes to diferent directories.

> 
> 
> So, let me rephrase my understanding of this issue so far. Before you
> made changes to trunk this was the behaviour:
> 
> 1. Forrest seed; forrest would generate the static site in English,
> regardless of your LANG env.
> 
sure. There is not implementation to seed a project with examples in 
spanish..



> 2. Setting project.i18n=true in forrest.properties and running forrest
> again would generate your site in build/site/xx, where xx is determined
> by the LANG env. BUT, the generated static site is still all in English;
> no look up into the language-specific catalogues ever takes place.
> 

I can not reproduce this. "Forrest site" works for me.

> My goal for a static site is to be able to issue the command
> 
> $ LANG=es_ES forrest
> 
have you try to issue "export LANG=es" ??????? I think that I told you 
before.

cheers,
cheche

Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by "Pedro I. Sanchez" <ps...@colcan.biz>.
On Wed, 2005-01-06 at 12:02 +0200, Juan Jose Pablos wrote:
> Pedro I. Sanchez wrote:
> > 
> > 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.
> > 
> 
> are you sure that the $LANG property is set on your system?
> if not do an "export LANG=es_ES"
> 
> do an echo $LANG before running "forrest site" to verify that the change 
> has been made.
> 
The string $(env.LANG} works well inside main/forrest.build.xml. It was
the default before you made changes to the trunk. But the same string is
ignored when you use it inside webapp/sitemap.xmap (skin labels are
looked up in the English dictionary, even if LANG=es_ES).

> > 
> > 1) First change
> > 
> > -#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.
> 
> The i18naction does not know anything about project.language that is why 
>   it does not translate
> 
That's what I was trying to figure out in my 'second change'.

> 
> > 
> > 2) Second change: Reflecting these changes in the sitemap
> 
> > 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.
> > 
> 
> Well you change the new stuff about a skin i18n aware. There is more 
> stuff that needs to change. Still, I think that the main issue that you 
> have is that forrest does not get you env.LANG property.
> 
forrest.build.xml does. sitemap.xmap doesn't.

> I have change that so it uses {user.language} instead. try to "svn up" 
> and report if that is working for you.
> 
I don't believe what you did is right, sorry if I misunderstand :|
You replaced my 'project.language' with 'user.language' but you are not
defining 'user.language' in forrest.build.xml. So it does nothing when I
use it in my site's 'forrest.properties'.



So, let me rephrase my understanding of this issue so far. Before you
made changes to trunk this was the behaviour:

1. Forrest seed; forrest would generate the static site in English,
regardless of your LANG env.

2. Setting project.i18n=true in forrest.properties and running forrest
again would generate your site in build/site/xx, where xx is determined
by the LANG env. BUT, the generated static site is still all in English;
no look up into the language-specific catalogues ever takes place.

With your changes to the trunk this is the current behaviour:

1. As before.

2. Setting project.i18n=true in forrest.properties and running forrest
again would generate your static site in build/site/en, regardless of
your LANG env. This is not the expected behaviour. And the site is
generated in English as before, no changes here.


My goal for a static site is to be able to issue the command

$ LANG=es_ES forrest

and get two things:

a) My site is built under build/site/es. This was OK before your
changes. It's not the case anymore.

b) Get the generated static site with Spanish skin labels. This was not
happening before and it's not happening now. The reason? We still have
the line

<map:parameter name="locale" value="{request:locale}"/>

in sitemap.xmap which makes the translation unaware of the LANG setting.
Replacing it with

<map:parameter name="locale" value="${env.LANG}"/>

doesn't work. Replacing it with

<map:parameter name="locale" value="{project.language}"/>

gives a NULL pointer somewhere.

I have some ideas on the i18n behaviour I'd like to see when generating
a static site which I'll share in a different e-mail.

Cheers,

-- 
Pedro



Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by Juan Jose Pablos <ch...@apache.org>.
Pedro I. Sanchez wrote:
> 
> 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.
> 

are you sure that the $LANG property is set on your system?
if not do an "export LANG=es_ES"

do an echo $LANG before running "forrest site" to verify that the change 
has been made.

> 
> 1) First change
> 
> -#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.

The i18naction does not know anything about project.language that is why 
  it does not translate


> 
> 2) Second change: Reflecting these changes in the sitemap

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

Well you change the new stuff about a skin i18n aware. There is more 
stuff that needs to change. Still, I think that the main issue that you 
have is that forrest does not get you env.LANG property.

I have change that so it uses {user.language} instead. try to "svn up" 
and report if that is working for you.


Cheers,
cheche

Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by "Pedro I. Sanchez" <ps...@colcan.biz>.
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



Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by Thorsten Scherler <th...@apache.org>.
On Sat, 2005-06-04 at 23:03 -0400, Pedro I. Sanchez wrote:
> On Sun, 2005-05-06 at 04:19 +0200, Thorsten Scherler wrote:
> > On Sat, 2005-06-04 at 20:55 -0400, Pedro I. Sanchez wrote:
> > <snip/>
> > > 
> > > My version of the Spanish messages would be the following:
> > > 
> > > <catalogue>
> > >   <message key="Font size:">Tamaño del texto:</message>
> > >   <message key="Last Published:">Fecha de publicación:</message>
> > >   <message key="Search">Buscar</message>
> > >   <message key="Search the site with">Buscar en</message>
> > > </catalogue>
> > > 
> > 
> > Nice, can you prepare a patch and add it to this issue? I will apply it
> > then, thx. I reckon there are more to come. ;-)
> > 
> Index: webapp/skins/common/messages/CommonMessages_es.xml
> ===================================================================
> --- webapp/skins/common/messages/CommonMessages_es.xml  (revision
> 180032)
> +++ webapp/skins/common/messages/CommonMessages_es.xml  (working copy)
> @@ -15,8 +15,9 @@
>    limitations under the License.
>  -->
>  <catalogue>
> -  <message key="Font size:">Tamaño de fuente:</message>
> -  <message key="Last Published:">Último publicado:</message>
> -  <message key="Search">Búsqueda</message>
> -  <message key="Search the site with">Búsqueda en</message>
> +  <message key="Font size:">Tamaño del texto:</message>
> +  <message key="Last Published:">Fecha de publicación:</message>
> +  <message key="Search">Buscar</message>
> +  <message key="Search the site with">Buscar en</message>
>  </catalogue>
> +
> 

Patch applied to trunk.

> > > Now, how do i specify the desired language? The i18n doc talks about
> > > specifying the locale in the transform, I guess in a map file. Ideally
> > > it should be specified forrest.properties, or even better at the command
> > > line, like:
> > > 
> > > $ LANG=de_DE forrest
> > > 
> > > How is it done now?
> > > 
> > 
> > Actually I just tested it in 'forrest run' and not forrest. 
> > 
> > In the dynamic mode you can change the preferred language of your
> > browser and hit refresh.
> > 
> In my experience, relying on the end user to select a language in his
> browser is never a good option. Most people don't even know they can do
> it. And you don't want your web pages to have to explain how to change
> the language option so that the pages can be read in a different
> language.
> 

Yeah you are right I guess we need some pics or a form to change the
locals via the site. Patches welcome. ;-) I will have a look later.

> In my case, my short-time interest is to generate a site that will show
> up in Spanish only, and this regardless of the language option of the
> web browser. In real life most web sites are written in a single
> language and they show up as such regardless of the language settings in
> the web browsers.
> 
> > Right now you find in the main forrest sitemap.xmap:
> > <map:transform type="i18n">
> > <map:parameter name="locale" value="{request:locale}"/>
> > </map:transform>
> > 
> > The question is how to parse the request:locale to the cli? ATM I do not
> > know that, but I guess that is possible. ;-)
> > 
> 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?

> > > One other comment: You are placing the catalogues under common/messages,
> > > which is probably fine for the default skin. But I believe that skins
> > > should come with their own catalogues because each can have an entirely
> > > different set of labels to be translated. Is this being accommodated by
> > > the skins "plugin" thing?
> > > 
> > Yes, this will go into views for now I added it to viewHelper.xhtml.
> > There are some points I found out for a full i18n support for skins
> > (view based). ...but this will be another thread. ;-)
> > 
> > I reckon you have to extend the catalogues section like the following,
> > but I have not test that.
> > <catalogues default="common">
> >   <catalogue id="common" name="CommonMessages"
> > location="skins/common/messages"/>
> > <catalogue id="{forrest:skin}" name="{forrest:skin}Messages"
> > location="skins/{forrest:skin}/messages"/>
> > </catalogues>
> > 
> Yes, I was thinking along these lines. Each skin has to have its own
> catalogue as an extension of a common catalogue that all skins can use.
> But I read something about a skins "plugin" in development and I was
> wondering how this plugin would automatically update this index of
> catalogues.
> 

Actually that needs discussion. Right now the catalogues are in 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/messages/

I am not sure what would be the best to automatically update this index
of catalogues and whether this should be done by the plugin. For now we
just add all messages of the contract there. 

...but you are right we have to think how to mount as well
project-specific catalogues.

Any thoughts, how?


salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by Ross Gardler <rg...@apache.org>.
Pedro I. Sanchez wrote:
> On Sun, 2005-05-06 at 04:19 +0200, Thorsten Scherler wrote:
> 
>>On Sat, 2005-06-04 at 20:55 -0400, Pedro I. Sanchez wrote:

...

>>Nice, can you prepare a patch and add it to this issue? I will apply it
>>then, thx. I reckon there are more to come. ;-)
>>
> 
> Index: webapp/skins/common/messages/CommonMessages_es.xml

Pedro, thanks for your patch.

Just a point to note, in future it is best to attach a patch to a
related issue, that way it doesn't get lost in the archives. In this
case Thorsten is on the ball so it doesn't matter, but imagine he had
been called away for work. An email is easy to forget about, a patch isn't.

Once again, thanks for highlighting this need, and for your contribution.

Ross


Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by "Pedro I. Sanchez" <ps...@colcan.biz>.
On Sun, 2005-05-06 at 04:19 +0200, Thorsten Scherler wrote:
> On Sat, 2005-06-04 at 20:55 -0400, Pedro I. Sanchez wrote:
> <snip/>
> > 
> > My version of the Spanish messages would be the following:
> > 
> > <catalogue>
> >   <message key="Font size:">Tamaño del texto:</message>
> >   <message key="Last Published:">Fecha de publicación:</message>
> >   <message key="Search">Buscar</message>
> >   <message key="Search the site with">Buscar en</message>
> > </catalogue>
> > 
> 
> Nice, can you prepare a patch and add it to this issue? I will apply it
> then, thx. I reckon there are more to come. ;-)
> 
Index: webapp/skins/common/messages/CommonMessages_es.xml
===================================================================
--- webapp/skins/common/messages/CommonMessages_es.xml  (revision
180032)
+++ webapp/skins/common/messages/CommonMessages_es.xml  (working copy)
@@ -15,8 +15,9 @@
   limitations under the License.
 -->
 <catalogue>
-  <message key="Font size:">Tamaño de fuente:</message>
-  <message key="Last Published:">Último publicado:</message>
-  <message key="Search">Búsqueda</message>
-  <message key="Search the site with">Búsqueda en</message>
+  <message key="Font size:">Tamaño del texto:</message>
+  <message key="Last Published:">Fecha de publicación:</message>
+  <message key="Search">Buscar</message>
+  <message key="Search the site with">Buscar en</message>
 </catalogue>
+

> > Now, how do i specify the desired language? The i18n doc talks about
> > specifying the locale in the transform, I guess in a map file. Ideally
> > it should be specified forrest.properties, or even better at the command
> > line, like:
> > 
> > $ LANG=de_DE forrest
> > 
> > How is it done now?
> > 
> 
> Actually I just tested it in 'forrest run' and not forrest. 
> 
> In the dynamic mode you can change the preferred language of your
> browser and hit refresh.
> 
In my experience, relying on the end user to select a language in his
browser is never a good option. Most people don't even know they can do
it. And you don't want your web pages to have to explain how to change
the language option so that the pages can be read in a different
language.

In my case, my short-time interest is to generate a site that will show
up in Spanish only, and this regardless of the language option of the
web browser. In real life most web sites are written in a single
language and they show up as such regardless of the language settings in
the web browsers.

> Right now you find in the main forrest sitemap.xmap:
> <map:transform type="i18n">
> <map:parameter name="locale" value="{request:locale}"/>
> </map:transform>
> 
> The question is how to parse the request:locale to the cli? ATM I do not
> know that, but I guess that is possible. ;-)
> 
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 :|

> > One other comment: You are placing the catalogues under common/messages,
> > which is probably fine for the default skin. But I believe that skins
> > should come with their own catalogues because each can have an entirely
> > different set of labels to be translated. Is this being accommodated by
> > the skins "plugin" thing?
> > 
> Yes, this will go into views for now I added it to viewHelper.xhtml.
> There are some points I found out for a full i18n support for skins
> (view based). ...but this will be another thread. ;-)
> 
> I reckon you have to extend the catalogues section like the following,
> but I have not test that.
> <catalogues default="common">
>   <catalogue id="common" name="CommonMessages"
> location="skins/common/messages"/>
> <catalogue id="{forrest:skin}" name="{forrest:skin}Messages"
> location="skins/{forrest:skin}/messages"/>
> </catalogues>
> 
Yes, I was thinking along these lines. Each skin has to have its own
catalogue as an extension of a common catalogue that all skins can use.
But I read something about a skins "plugin" in development and I was
wondering how this plugin would automatically update this index of
catalogues.

-- 
Pedro


> salu2


Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by Thorsten Scherler <th...@apache.org>.
On Sat, 2005-06-04 at 20:55 -0400, Pedro I. Sanchez wrote:
<snip/>
> 
> My version of the Spanish messages would be the following:
> 
> <catalogue>
>   <message key="Font size:">Tamaño del texto:</message>
>   <message key="Last Published:">Fecha de publicación:</message>
>   <message key="Search">Buscar</message>
>   <message key="Search the site with">Buscar en</message>
> </catalogue>
> 

Nice, can you prepare a patch and add it to this issue? I will apply it
then, thx. I reckon there are more to come. ;-)

> Now, how do i specify the desired language? The i18n doc talks about
> specifying the locale in the transform, I guess in a map file. Ideally
> it should be specified forrest.properties, or even better at the command
> line, like:
> 
> $ LANG=de_DE forrest
> 
> How is it done now?
> 

Actually I just tested it in 'forrest run' and not forrest. 

In the dynamic mode you can change the preferred language of your
browser and hit refresh.

Right now you find in the main forrest sitemap.xmap:
<map:transform type="i18n">
<map:parameter name="locale" value="{request:locale}"/>
</map:transform>

The question is how to parse the request:locale to the cli? ATM I do not
know that, but I guess that is possible. ;-)

> One other comment: You are placing the catalogues under common/messages,
> which is probably fine for the default skin. But I believe that skins
> should come with their own catalogues because each can have an entirely
> different set of labels to be translated. Is this being accommodated by
> the skins "plugin" thing?
> 
Yes, this will go into views for now I added it to viewHelper.xhtml.
There are some points I found out for a full i18n support for skins
(view based). ...but this will be another thread. ;-)

I reckon you have to extend the catalogues section like the following,
but I have not test that.
<catalogues default="common">
  <catalogue id="common" name="CommonMessages"
location="skins/common/messages"/>
<catalogue id="{forrest:skin}" name="{forrest:skin}Messages"
location="skins/{forrest:skin}/messages"/>
</catalogues>

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: [jira] Commented: (FOR-506) Do not hard-code site-visible message strings in skin files

Posted by "Pedro I. Sanchez" <ps...@colcan.biz>.
On Sat, 2005-04-06 at 23:49 +0200, Thorsten Scherler wrote:
> On Sat, 2005-06-04 at 21:36 +0100, Ross Gardler wrote:
> > Pedro I. Sanchez wrote:
> > > On Sat, 2005-04-06 at 06:06 +0200, Thorsten Scherler (JIRA) wrote:
> > > 
> > >>    [ http://issues.apache.org/jira/browse/FOR-506?page=comments#action_12312612 ] 
> > >>
> > >>Thorsten Scherler commented on FOR-506:
> > >>---------------------------------------
> > >>
> > 
> > ...
> > 
> > >>So what we need is that 
> > >>1) we surround all captions with <i18n:text /> tags
> > >>2) add this keys to the catalogue
> > > 
> > > 
> > > Where is the catalogue where I need to add the keys/values to?
> > 
> > They are attached to the issue in the patch that Thorsten uploaded.
> > 
> > Ross
> 
> In revision 180026 I added (I applied the patch to trunk):
> main/webapp/skins/common/messages/CommonMessages_es.xml
> main/webapp/skins/common/messages/CommonMessages_de.xml
> main/webapp/skins/common/messages/CommonMessages_us.xml
> 
> That are the catalogues.
> 
> I guess the work should start in creating one master 
> main/webapp/skins/common/messages/CommonMessages_us.xml
> and add all skin keys to it. Then
> cp main/webapp/skins/common/messages/CommonMessages_us.xml
> main/webapp/skins/common/messages/CommonMessages_{language_country_variant}.xml
> 
> and translate the keys.
> 
> HTH
> 
> salu2

My version of the Spanish messages would be the following:

<catalogue>
  <message key="Font size:">Tamaño del texto:</message>
  <message key="Last Published:">Fecha de publicación:</message>
  <message key="Search">Buscar</message>
  <message key="Search the site with">Buscar en</message>
</catalogue>

Now, how do i specify the desired language? The i18n doc talks about
specifying the locale in the transform, I guess in a map file. Ideally
it should be specified forrest.properties, or even better at the command
line, like:

$ LANG=de_DE forrest

How is it done now?

One other comment: You are placing the catalogues under common/messages,
which is probably fine for the default skin. But I believe that skins
should come with their own catalogues because each can have an entirely
different set of labels to be translated. Is this being accommodated by
the skins "plugin" thing?

-- 
Pedro
 


There's a couple of things