[PHPTAL] Translation and HTML markup

2009-08-18 Thread Alister Cameron
I have this string as the translation key:
You must be a href=path/goes/here title=Log inlogged in/a to post a
comment.

Two issues with it...

1. I want the href to be a variable.
2. I want the HTML retained.

To replace the variable I could use the i18n:attributes=href /path/to/var
approach, but I assume that is incompatible with the fact that the string
itself is up for translation. How do I do that then??

And as for the HTML, I could use:

div i18n:translate=structure 'You must be a href=path/goes/here
title=Log inlogged in/a to post a comment.' /

But I see two issues
here. First, the double quotes, I assume, in the string, won't work.
Secondly, it looks too damn ugly putting this whole string within an
attribute of the div tag. Just yuk.

Would this work? (I assume not) -

div i18n:translate=structureYou must be a href=path/goes/here
title=Log inlogged in/a to post a comment.
/div

And even if that does work, how do I bring it all together so that both the
HTML is retained AND the variable substitution occurs?!

The only markup I can even come up with (which I haven't yet tested) is:

div i18n:translate=structureYou must be a href=path/goes/here
title=Log in i18n:attributes=href path/to/varlogged in/a to post a
comment.
/div

What WILL work, oh gurus?!

Cheers,

-Alister

---
Alister Cameron // Blogologist
http://www.alistercameron.com

Mob. 04 0404 
Fax 03 8610 0050

Click here to find me online:
http://clicktoadd.me/alicam
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] Translation and HTML markup

2009-08-18 Thread Kornel Lesiński
On 18-08-2009 at 08:25:32 Alister Cameron  
alister.came...@cameroncreative.com wrote:



I have this string as the translation key:
You must be a href=path/goes/here title=Log inlogged in/a to  
post a comment.


Two issues with it...

1. I want the href to be a variable.
2. I want the HTML retained.

To replace the variable I could use the i18n:attributes=href  
/path/to/var

approach, but I assume that is incompatible with the fact that the string
itself is up for translation. How do I do that then??


Try this:

div i18n:translate=structureYou must be a i18n:name=loginlink  
href=path/goes/here title=Log inspan i18n:translate=logged  
in/span/a to post a comment./div



Outer i18n:translate will translate You must be ${loginlink} to post a  
comment, i18n:name will ensure link is placed in appropriate place and  
inner i18n:translate will translate link label (PHPTAL doesn't allow  
i18n:translate and name on same element, that's why there's span.)



--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] Translation and HTML markup

2009-08-18 Thread Alister Cameron
Thanks heaps Kornel.
Can I extend this with variable substitution of the href attribute? As:

div i18n:translate=structureYou must be a i18n:name=loginlink href=
title=Log in tal:replace=href tal/path/herespan
i18n:translate=logged in/span/a to post a comment./div

??

-Alister

2009/8/18 Kornel Lesiński kor...@aardvarkmedia.co.uk

 On 18-08-2009 at 08:25:32 Alister Cameron 
 alister.came...@cameroncreative.com wrote:

  I have this string as the translation key:
 You must be a href=path/goes/here title=Log inlogged in/a to post
 a comment.

 Two issues with it...

 1. I want the href to be a variable.
 2. I want the HTML retained.

 To replace the variable I could use the i18n:attributes=href
 /path/to/var
 approach, but I assume that is incompatible with the fact that the string
 itself is up for translation. How do I do that then??


 Try this:

 div i18n:translate=structureYou must be a i18n:name=loginlink
 href=path/goes/here title=Log inspan i18n:translate=logged
 in/span/a to post a comment./div


 Outer i18n:translate will translate You must be ${loginlink} to post a
 comment, i18n:name will ensure link is placed in appropriate place and
 inner i18n:translate will translate link label (PHPTAL doesn't allow
 i18n:translate and name on same element, that's why there's span.)


 --
 regards, Kornel

 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal




-- 
Alister Cameron
Managing Director
Cameron Creative Pty Ltd
www.cameroncreative.com

Creative, Strategic, Innovative... never boring!
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] Translation and HTML markup

2009-08-18 Thread Kornel Lesiński
On 18-08-2009 at 11:04:02 Alister Cameron  
alister.came...@cameroncreative.com wrote:



Thanks heaps Kornel.
Can I extend this with variable substitution of the href attribute? As:

div i18n:translate=structureYou must be a i18n:name=loginlink  
href=

title=Log in tal:replace=href tal/path/herespan
i18n:translate=logged in/span/a to post a comment./div

??


Yes, just use tal:attributes for href (assuming you want it specified by  
the application and not translation file) and i18n:attributes for title.


--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal