Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
merged branch umpirsky/i18n-doc-update (PR #65)
Browse files Browse the repository at this point in the history
Commits
-------

562b218 Twig Gettext Extractor mentioned.
dc5580f Fixed extracting template strings example.

Discussion
----------

I18n doc update
  • Loading branch information
fabpot committed Sep 4, 2012
2 parents 7669b6b + 562b218 commit f904575
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions doc/i18n.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ templates. Here is a simple example to get you started::
// iterate over all your templates // iterate over all your templates
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tplDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tplDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file)
{ {
// force compilation // force compilation
$twig->loadTemplate(str_replace($tplDir.'/', '', $file)); if ($file->isFile()) {
$twig->loadTemplate(str_replace($tplDir.'/', '', $file));
}
} }


Use the standard ``xgettext`` utility as you would have done with plain PHP Use the standard ``xgettext`` utility as you would have done with plain PHP
Expand All @@ -152,5 +154,10 @@ code:
xgettext --default-domain=messages -p ./locale --from-code=UTF-8 -n --omit-header -L PHP /tmp/cache/*.php xgettext --default-domain=messages -p ./locale --from-code=UTF-8 -n --omit-header -L PHP /tmp/cache/*.php
.. _`gettext`: http://www.php.net/gettext Another workaround is to use `Twig Gettext Extractor`_ and extract the template
.. _`documentation`: http://fr.php.net/manual/en/function.gettext.php strings right from `Poedit`_.

.. _`gettext`: http://www.php.net/gettext
.. _`documentation`: http://fr.php.net/manual/en/function.gettext.php
.. _`Twig Gettext Extractor`: https://github.com/umpirsky/Twig-Gettext-Extractor
.. _`Poedit`: http://www.poedit.net/

0 comments on commit f904575

Please sign in to comment.