Afficher un message
Vieux 30/05/2006, 13h11   #1
D_C
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut smarty and GNU gettext

hi list -

there is a great GNU library for dealing with localisation, that has a
php function gettext()
http://www.php.net/manual/en/function.gettext.php

many high-end PHP projects use this (wordpress, drupal).

I was wondering if there is a way to use this with smarty?

basically gettext is a php function, so if this is used in the middle
of a smarty template, it will make templates really ugly. I think!
Unless there is a clean way to inline php funcs inside smarty...

also, since a php funciton is being called in the middle of a
template, i imagine this stops smarty from being able to pre-compie/
cache the template itself?

So, any suggested approaches?

Can a modifier function work directly on a string? eg if i created a
localize() modifier that called gettext, then:

had a template like this:

{ "message list" | localize }

rather than puttig the english "message list" in a separate tag to be
passed to smarty:

{$messageListTag|localize}

this would require all the tags to be read in ahead of time, and
another level of indirection + probably reading lots of irrelevant
tags per page.

thanks for any as always!

/dc
--
_______________________________________________
David "DC" Collier

dc@pikkle.com
skype: callto://d3ntaku
http://www.pikkle.com
+81 (0)80 6521 9559

http://charajam.com$B!!!Z!z%-%c%i"v%8%c%`!z![(B
$B?M5$%-%c%i$H(BJ-POP$B:G?7%R%C%H6J$r<+J,$GAH$_9g$o$;$F(B
$BBT<u(BFlash$B$dCe(BFlash$B$r:n$C$A$c$*$&!* (B
_______________________________________________
  Réponse avec citation
 
Page generated in 0,05555 seconds with 9 queries