|
Size: | 12071 |
Storage flags: | no_autoload,compress/gzip (30%) |
The Translate view helper can be used to translate content. It acts as a wrapper for the Zend\I18n\Translator\Translator class.
Before using the Translate view helper, you must have first created a Translator object and have attached it to the view helper. If you use the Zend\View\HelperPluginManager to invoke the view helper, this will be done automatically for you.
1 2 3 4 5 6 7 8 9 | // Within your view
echo $this->translate("Some translated text.");
echo $this->translate("Translated text from a custom text domain.", "customDomain");
echo sprintf($this->translate("The current time is %s."), $currentTime);
echo $this->translate("Translate in a specific locale", "default", "de_DE");
|
Parameters: |
|
---|
The xgettext utility can be used to compile *.po files from PHP source files containing the translate view helper.
xgettext --language=php --add-location --keyword=translate my-view-file.phtml
See the Gettext Wikipedia page for more information.
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.