<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
The developer of Twig have made an i18n-extension.<br>
Download the latest Twig Sanpshot: git://github.com/fabpot/Twig.git<br>
<br>
Or use this code-snippet (what I've done):<br>
<div class="highlight">
<pre><div class="line" id="LC1"><span class="cp"><?php</span></div><div
class="line" id="LC3"><span class="k">class</span> <span class="nc">Gettext_Twig_Extension</span> <span
class="k">extends</span> <span class="nx">Twig_Extension</span></div><div
class="line" id="LC4"><span class="p">{</span></div><div class="line"
id="LC5"> <span class="k">public</span> <span class="k">function</span> <span
class="nf">getFilters</span><span class="p">()</span></div><div
class="line" id="LC6"> <span class="p">{</span></div><div
class="line" id="LC7"> <span class="k">return</span> <span
class="k">array</span><span class="p">(</span></div><div class="line"
id="LC8"> <span class="s1">'t'</span> <span class="o">=></span> <span
class="k">new</span> <span class="nx">Twig_Filter_Function</span><span
class="p">(</span><span class="s1">'gettext'</span><span class="p">),</span></div><div
class="line" id="LC9"> <span class="p">);</span></div><div
class="line" id="LC10"> <span class="p">}</span></div><div
class="line" id="LC11"><span class="p">}</span></div><div class="line"
id="LC14"><span class="cm">/*</span></div><div class="line" id="LC15"><span
class="cm">$twig = new Twig_Environment(...);</span></div><div
class="line" id="LC16"><span class="cm">$twig->addExtension('Gettext_Twig_Extension.class.php');</span></div><div
class="line" id="LC19"><span class="cm">{{ 'MY_USERNAME'|t }} can now be used in templates to display the gettext string associated with the "MY_USERNAME" key.</span></div><div
class="line" id="LC20"><span class="cm">*/</span></div></pre>
</div>
<br>
Am 15.03.2010 13:29, schrieb Tomas Srnka:
<blockquote
cite="mid:bf91ee4c1003150529q7b103c7ve6bc83066587a026@mail.gmail.com"
type="cite">Hi,
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Thank you!</div>
<div><br>
</div>
<div>Best regards,</div>
<div>Tomas Srnka</div>
<div><br>
<div class="gmail_quote">On Mon, Mar 15, 2010 at 12:29 PM, Michael
Keck <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:sfnet@michaelkeck.de">sfnet@michaelkeck.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi
Michal,<br>
<br>
I've found a solution and it worked for me now:<br>
I've contacted the developer of TWIG and he gives me a sample filter for<br>
gettext. So I can use in templates as an expample {{ 'Welcome to<br>
phpMyAdmin'|t }}.<br>
<br>
I know, that phpMyAdmin should still work without javascript. Javascript<br>
should only be a feature. But if user want to use javascript, this<br>
should be secure enough.<br>
<br>
I guess with you, that with wrong encoding/charset in browser settings<br>
also text in pages may be displayed wrong, but phpMyAdmin still works.<br>
Perhabs I will see 'L?schen' instead of 'Löschen', but it still works.<br>
But it's different in javascript (I've written many javascripts in
past):<br>
With wrong encoding/charset in browser settings, you'll get 'Löschen'<br>
(or something other terrible for javascript like 'ä' for the letter<br>
'ä') for the string 'Löschen', which crashes all used javascripts.<br>
With my "bulletproof"-suggestion (using 'L\u00F6schen' instead of<br>
'Löschen'), only the text is displayed wrong (I will see 'L\u00F6schen'<br>
or 'L?schen' instead 'Löschen'), but javascript still working.<br>
<br>
Regards<br>
<font color="#888888">Michael<br>
</font><br>
------------------------------------------------------------------------------<br>
Download Intel® Parallel Studio Eval<br>
Try the new software tools for yourself. Speed compiling, find bugs<br>
proactively, and fine-tune applications for parallel performance.<br>
See why Intel Parallel Studio got high marks during beta.<br>
<a moz-do-not-send="true" href="http://p.sf.net/sfu/intel-sw-dev"
target="_blank">http://p.sf.net/sfu/intel-sw-dev</a><br>
_______________________________________________<br>
Phpmyadmin-devel mailing list<br>
<a moz-do-not-send="true"
href="mailto:Phpmyadmin-devel@lists.sourceforge.net">Phpmyadmin-devel@lists.sourceforge.net</a><br>
<a moz-do-not-send="true"
href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel"
target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
</body>
</html>