How to View Text that is Run Through the Symfony 2 Translator by Highlighting Translations

The Symfony 2 translator does a great job at translating text but there is not a great way to quickly see what text in a project is translated, especially when it could be translated by Symfony internally, in a model file, in a controller, in a twig template, etc. Given all of the different options, how could you quickly confirm text is running through the translator, and running through the translator only one time, so you don’t end up double translating text. more…


Change the Symfony 2 Validator Translation Domain and File Path

Change the translation path for the Symfony 2 validator

By default, the translation domain for the Symfony 2 validator is ‘validators’ and the translations are stored in the resources/translations/validators.<locale>.xliff files. In some applications it might be nice to use the same translation file as the rest of the site translations for validation messages, rather than using a separate validation translation file. Symfony makes this easy by setting a single parameter.

more…


Localize Scripts in WordPress to Use PHP Variables in Javascript

Accessing PHP variables in javascript using WordPress can come in very handy, especially in plugins or themes that use separate javascript files and php page templates where accessing a variable is not possible to do directly. A great example of where this would be necessary is when you have a string that needs to be translated using PHP but is to be rendered using javascript, maybe in an alert box or error message more…


Extend Symfony 2 Translator to Log Untranslated Messages to a Database

Log translation messages to the database in Symfony 2

The Symfony 2 translation service does a fantastic job of translating messages using the file system and translation messages.locale.xliff files.  Gathering all of the i18n source phrases to hand off to a translator or translation service can be a major challenge, especially in a large, dynamic website.  The goal here is to provide a logging mechanism to add un-translated text to a database more…