cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Salvetti <salvetti.m...@gmail.com>
Subject Re: [2.1] Non-trivial uses of i18n transformer
Date Mon, 23 May 2016 23:57:33 GMT
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 <chris@christopherschultz.net
>:

> 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 <a title="some.catalogue:some.text"
> >> > 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:
> >>
> >> <script type="text/javascript"><xsl:comment>
> >>   function whatever() {
> >>     document.getElementById('link').title = 'translated-text';
> >>   }
> >> </xsl:comment></script>
> >>
> >> Probably the simplest way is to just remove the <xsl:comment> 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
> >
> > <script type="text/javascript">
> > <![CDATA[
> >   function whatever() {
> >     document.getElementById('link').title = 'translated-text';
> >   }
> > ]]>
> > </script>
>
> Since the 'translated-text' is really <i18n:text>, it would be ignored
> if it were in a CDATA section.
>
> <script type="text/javascript">
> <![CDATA[
>   function whatever() {
>     document.getElementById('link').title = '<i18n:text key="foo" />';
>   }
> ]]>
> </script>
>
> That's not going to work any better than the javascript embedded within
> an <xsl:comment> element, right?
>
> Thanks,
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Mime
View raw message