Translation in JavaScript like gettext in PHP?
I am using gettext in my PHP code, but I have a big problem. All my JavaScript files are not affected by the translation, can somebody tell me an easy way to get the translations in the chosen language into JavaScript as well. 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="js_lang.php"></script> I would also recommend this