<?phpclass Gettext_Twig_Extension extends Twig_Extension{ public function getFilters() { return array( 't' => new Twig_Filter_Function('gettext'), ); }}/*$twig = new Twig_Environment(...);$twig->addExtension('Gettext_Twig_Extension.class.php');{{ 'MY_USERNAME'|t }} can now be used in templates to display the gettext string associated with the "MY_USERNAME" key.*/
Hi,
could you please publish the filter somewhere? There is a message in TWIG's mailing list without any reply regarding gettext and I'm planning to use TWIG+gettext in my own project.
Thank you!
Best regards,Tomas Srnka
On Mon, Mar 15, 2010 at 12:29 PM, Michael Keck <sfnet@michaelkeck.de> wrote:
Hi Michal,
I've found a solution and it worked for me now:
I've contacted the developer of TWIG and he gives me a sample filter for
gettext. So I can use in templates as an expample {{ 'Welcome to
phpMyAdmin'|t }}.
I know, that phpMyAdmin should still work without javascript. Javascript
should only be a feature. But if user want to use javascript, this
should be secure enough.
I guess with you, that with wrong encoding/charset in browser settings
also text in pages may be displayed wrong, but phpMyAdmin still works.
Perhabs I will see 'L?schen' instead of 'Löschen', but it still works.
But it's different in javascript (I've written many javascripts in past):
With wrong encoding/charset in browser settings, you'll get 'Löschen'
(or something other terrible for javascript like 'ä' for the letter
'ä') for the string 'Löschen', which crashes all used javascripts.
With my "bulletproof"-suggestion (using 'L\u00F6schen' instead of
'Löschen'), only the text is displayed wrong (I will see 'L\u00F6schen'
or 'L?schen' instead 'Löschen'), but javascript still working.
Regards
Michael
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Phpmyadmin-devel mailing list
Phpmyadmin-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel