Re: [2.1] Non-trivial uses of i18n transformer

2016-05-23 Thread Marc Salvetti
Hello,

I don't think you can have translated text embeded in js code like this. I
think you have to move the string to the xml markup as in your first
message, then let js handle strings that are already translated

2016-05-23 21:24 GMT+07:00 Christopher Schultz :

> Francesco,
>
> On 5/23/16 9:58 AM, Francesco Chicchiriccò wrote:
> > On 23/05/2016 15:55, Christopher Schultz wrote:
> >> Marc,
> >>
> >> On 5/23/16 9:39 AM, Marc Salvetti wrote:
> >> > Try something like this  >> > I18n-attr="title"/>
> >>
> >> > That's by memory but should find the exact syntax in  the doc
> >>
> >> Yep, this totally works.
> >>
> >> Since I'm on a roll, how about this:
> >>
> >> 
> >>   function whatever() {
> >> document.getElementById('link').title = 'translated-text';
> >>   }
> >> 
> >>
> >> Probably the simplest way is to just remove the  from
> >> around the script, since I don't think that's actually been necessary
> >> since the days of MSIE4. Is there another convenient way to do it?
> >
> > Why not
> >
> > 
> >  >   function whatever() {
> > document.getElementById('link').title = 'translated-text';
> >   }
> > ]]>
> > 
>
> Since the 'translated-text' is really , it would be ignored
> if it were in a CDATA section.
>
> 
>    function whatever() {
> document.getElementById('link').title = '';
>   }
> ]]>
> 
>
> That's not going to work any better than the javascript embedded within
> an  element, right?
>
> Thanks,
> -chris
>
> -
> To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
> For additional commands, e-mail: users-h...@cocoon.apache.org
>
>


Re: [2.1] Non-trivial uses of i18n transformer

2016-05-23 Thread Francesco Chicchiriccò

On 23/05/2016 16:24, Christopher Schultz wrote:

Francesco,

On 5/23/16 9:58 AM, Francesco Chicchiriccò wrote:

On 23/05/2016 15:55, Christopher Schultz wrote:

Marc,

On 5/23/16 9:39 AM, Marc Salvetti wrote:

Try something like this 
That's by memory but should find the exact syntax in  the doc

Yep, this totally works.

Since I'm on a roll, how about this:


   function whatever() {
 document.getElementById('link').title = 'translated-text';
   }


Probably the simplest way is to just remove the  from
around the script, since I don't think that's actually been necessary
since the days of MSIE4. Is there another convenient way to do it?

Why not





Since the 'translated-text' is really , it would be ignored
if it were in a CDATA section.


';
   }
]]>


That's not going to work any better than the javascript embedded within
an  element, right?


Ouch, you're definitely right :-)

Regards.

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC,
Olingo PMC, CXF Committer, OpenJPA Committer
http://home.apache.org/~ilgrosso/


-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org



Re: [2.1] Non-trivial uses of i18n transformer

2016-05-23 Thread Christopher Schultz
Francesco,

On 5/23/16 9:58 AM, Francesco Chicchiriccò wrote:
> On 23/05/2016 15:55, Christopher Schultz wrote:
>> Marc,
>>
>> On 5/23/16 9:39 AM, Marc Salvetti wrote:
>> > Try something like this > > I18n-attr="title"/>
>>
>> > That's by memory but should find the exact syntax in  the doc
>>
>> Yep, this totally works.
>>
>> Since I'm on a roll, how about this:
>>
>> 
>>   function whatever() {
>> document.getElementById('link').title = 'translated-text';
>>   }
>> 
>>
>> Probably the simplest way is to just remove the  from
>> around the script, since I don't think that's actually been necessary
>> since the days of MSIE4. Is there another convenient way to do it?
> 
> Why not
> 
> 
>    function whatever() {
> document.getElementById('link').title = 'translated-text';
>   }
> ]]>
> 

Since the 'translated-text' is really , it would be ignored
if it were in a CDATA section.


';
  }
]]>


That's not going to work any better than the javascript embedded within
an  element, right?

Thanks,
-chris

-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org



Re: [2.1] Non-trivial uses of i18n transformer

2016-05-23 Thread Francesco Chicchiriccò

On 23/05/2016 15:55, Christopher Schultz wrote:

Marc,

On 5/23/16 9:39 AM, Marc Salvetti wrote:
> Try something like this  I18n-attr="title"/>

> That's by memory but should find the exact syntax in  the doc

Yep, this totally works.

Since I'm on a roll, how about this:


  function whatever() {
document.getElementById('link').title = 'translated-text';
  }


Probably the simplest way is to just remove the  from
around the script, since I don't think that's actually been necessary
since the days of MSIE4. Is there another convenient way to do it?


Why not





?

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC,
Olingo PMC, CXF Committer, OpenJPA Committer
http://home.apache.org/~ilgrosso/



-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org



Re: [2.1] Non-trivial uses of i18n transformer

2016-05-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marc,

On 5/23/16 9:39 AM, Marc Salvetti wrote:
> Try something like this  I18n-attr="title"/>
> 
> That's by memory but should find the exact syntax in  the doc

Yep, this totally works.

Since I'm on a roll, how about this:


  function whatever() {
document.getElementById('link').title = 'translated-text';
  }


Probably the simplest way is to just remove the  from
around the script, since I don't think that's actually been necessary
since the days of MSIE4. Is there another convenient way to do it?

Thanks,
- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAldDC+EACgkQ9CaO5/Lv0PDbdQCfet+DodTVUTYu/zw0Y6FKu07a
QLkAn2RZgvnbABrZBM0P+eCFG7aCHNr+
=4NcC
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org



Re: [2.1] Non-trivial uses of i18n transformer

2016-05-23 Thread Francesco Chicchiriccò

On 23/05/2016 15:44, Christopher Schultz wrote:

Francesco,

On 5/23/16 9:41 AM, Francesco Chicchiriccò wrote:
> On 23/05/2016 15:39, Marc Salvetti wrote:
>>> Hi Chris, > > Try something like this  title="some.catalogue:some.text" I18n-attr="title"/> > > That's by
> memory but should find the exact syntax in  the doc Here it is:

> https://cocoon.apache.org/2.1/userdocs/i18nTransformer.html

> 
> This text will be translated. 

Aw, geez. How did I miss that in the docs? That's WAY better than the
stupid stuff I was coming up with.


You're welcome :-)

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC,
Olingo PMC, CXF Committer, OpenJPA Committer
http://home.apache.org/~ilgrosso/



-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org



Re: [2.1] Non-trivial uses of i18n transformer

2016-05-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Francesco,

On 5/23/16 9:41 AM, Francesco Chicchiriccò wrote:
> On 23/05/2016 15:39, Marc Salvetti wrote:
>>> Hi Chris, > > Try something like this  title="some.catalogue:some.text" I18n-attr="title"/> > > That's by 
> memory but should find the exact syntax in  the doc Here it is:
> 
> https://cocoon.apache.org/2.1/userdocs/i18nTransformer.html
> 
>  
> This text will be translated. 

Aw, geez. How did I miss that in the docs? That's WAY better than the
stupid stuff I was coming up with.

Thanks,
- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAldDCTIACgkQ9CaO5/Lv0PBt/ACgolWWUsFvXAHdCGehUxNoxN0F
TcwAmgKf5WgUHXvrvVTAzpi1IIvc5GOA
=xWAl
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org



Re: [2.1] Non-trivial uses of i18n transformer

2016-05-23 Thread Francesco Chicchiriccò

On 23/05/2016 15:39, Marc Salvetti wrote:
 > Hi Chris, > > Try something like this title="some.catalogue:some.text" I18n-attr="title"/> > > That's by 
memory but should find the exact syntax in  the doc

Here it is:

https://cocoon.apache.org/2.1/userdocs/i18nTransformer.html


  This text will be translated.


HTH
Regards.


Le 23 mai 2016 8:31 PM, "Christopher Schultz" > a écrit :  >
All,

I'm finally getting around to internationalizing the XSLT-based parts
of my application, and I'm running into a problem with non-trivial
uses of  in a template.

Here's an excellent example of the kind of thing I'm having trouble
with. I have a single XML document going through a pipeline with a few
transformations in it. There is one major transform where pretty much
everything interesting happens. I'd like to use  in there to
produce an HTML  element with a localized "title" attribute.
Something like this:


  click me


Localizing the "click me" text is trivial. Doing the same with the
"title" attribute is not.

   "  [...] >

That obviously won't work because the attribute won't be parsed and
evaluated by the XSLT parser. Use of {} around it doesn't work because
it's an element, not an expression.

  

  

[...]
  

That doesn't work because  evidently can't contain
. At first, this irritated me but then I realized that this
would never work, because the second case would basically degenerate
into the first case after the  completed its work for
this template before I (later) ran the I18nTransformer.

The only idea I've had is to flip the current i18n process on its head
and instead do this:

  





  

  



  



  

So instead of transforming the input document with an
internationalized stylesheet, then transforming the result with the
i18n transformer, I first transform the transformer itself to get a
localized transformer, and transform the input document with *that*.

Is that "recommended technique"? Alternatively, is that entirely stupid?

If this is a good idea, how specifically can I accomplish what I have
above? I haven't yet tried it, but I'm concerned I'll have the same
problem with elements not being allowed in other elements.

Any suggestions?

Thanks,
-chris


--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC,
Olingo PMC, CXF Committer, OpenJPA Committer
http://home.apache.org/~ilgrosso/




Re: [2.1] Non-trivial uses of i18n transformer

2016-05-23 Thread Marc Salvetti
Hi Chris,

Try something like this 

That's by memory but should find the exact syntax in  the doc

Hope this helps,
Marc
Le 23 mai 2016 8:31 PM, "Christopher Schultz" 
a écrit :

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> All,
>
> I'm finally getting around to internationalizing the XSLT-based parts
> of my application, and I'm running into a problem with non-trivial
> uses of  in a template.
>
> Here's an excellent example of the kind of thing I'm having trouble
> with. I have a single XML document going through a pipeline with a few
> transformations in it. There is one major transform where pretty much
> everything interesting happens. I'd like to use  in there to
> produce an HTML  element with a localized "title" attribute.
> Something like this:
>
> 
>   click me
> 
>
> Localizing the "click me" text is trivial. Doing the same with the
> "title" attribute is not.
>
>"  [...] >
>
> That obviously won't work because the attribute won't be parsed and
> evaluated by the XSLT parser. Use of {} around it doesn't work because
> it's an element, not an expression.
>
>   
> 
>   
> 
> [...]
>   
>
> That doesn't work because  evidently can't contain
> . At first, this irritated me but then I realized that this
> would never work, because the second case would basically degenerate
> into the first case after the  completed its work for
> this template before I (later) ran the I18nTransformer.
>
> The only idea I've had is to flip the current i18n process on its head
> and instead do this:
>
>   
> 
>
> 
>
> 
>   
>
>   
> 
>
> 
>   
> 
>
> 
>   
>
> So instead of transforming the input document with an
> internationalized stylesheet, then transforming the result with the
> i18n transformer, I first transform the transformer itself to get a
> localized transformer, and transform the input document with *that*.
>
> Is that "recommended technique"? Alternatively, is that entirely stupid?
>
> If this is a good idea, how specifically can I accomplish what I have
> above? I haven't yet tried it, but I'm concerned I'll have the same
> problem with elements not being allowed in other elements.
>
> Any suggestions?
>
> Thanks,
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iEYEARECAAYFAldDBi0ACgkQ9CaO5/Lv0PC3HQCfQLoPna+oFFoWxXggz0rKwxis
> vyAAn1IrMa5SNcy+8fhr6Wt5JxdJ8abT
> =i48t
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
> For additional commands, e-mail: users-h...@cocoon.apache.org
>
>