Translation in JavaScript like gettext in PHP?

The easiest way is having a PHP file write the translations from gettext into JavaScript variables. js_lang.php: word_hello = “<?php echo gettext(“hello”); ?>” word_world = “<?php echo gettext(“world”); ?>” word_how_are_you = “<?php echo gettext(“how_are_you”); ?>” and then include it: <script type=”text/javascript” src=”https://stackoverflow.com/questions/2400106/js_lang.php”></script> I would also recommend this method in conjunction with the translation plugins S.Mark … Read more

Django templates: Best practice for translating text block with HTML in it

From the docs: It’s not possible to mix a template variable inside a string within {% trans %}. If your translations require strings with variables (placeholders), use {% blocktrans %} instead. Then under blocktrans: To translate a template expression — say, accessing object attributes or using template filters — you need to bind the expression … Read more

Alternatives to gettext?

First of all I think gettext is one of the best at this point. You may take a look on Boost.Locale that may provide a better API and use gettext‘s dictionary model: http://cppcms.sourceforge.net/boost_locale/docs/ (not official part of Boost, still beta). Edit: If you don’t like gettext… These are translation technologies: OASIS XLIFF GNU gettext po/mo … Read more

How do you handle translation of text with markup?

Solution 2 is what you want. Send them the whole sentence, with the HTML markup embedded. Reasons: The predominant translation tool, Trados, can preserve the markup from inadvertent corruption by a translator. Trados can also auto-translate text that it has seen before, even if the content of the tags have changed (but the number of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)