Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

I18n doc update #65

Merged
merged 2 commits into from

2 participants

@umpirsky

No description provided.

@fabpot fabpot referenced this pull request from a commit
@fabpot fabpot merged branch umpirsky/i18n-doc-update (PR #65)
Commits
-------

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

Discussion
----------

I18n doc update
f904575
@fabpot fabpot merged commit 562b218 into twigphp:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 4 deletions.
  1. +11 −4 doc/i18n.rst
View
15 doc/i18n.rst
@@ -141,8 +141,10 @@ templates. Here is a simple example to get you started::
// iterate over all your templates
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tplDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file)
{
- // force compilation
- $twig->loadTemplate(str_replace($tplDir.'/', '', $file));
+ // force compilation
+ if ($file->isFile()) {
+ $twig->loadTemplate(str_replace($tplDir.'/', '', $file));
+ }
}
Use the standard ``xgettext`` utility as you would have done with plain PHP
@@ -152,5 +154,10 @@ code:
xgettext --default-domain=messages -p ./locale --from-code=UTF-8 -n --omit-header -L PHP /tmp/cache/*.php
-.. _`gettext`: http://www.php.net/gettext
-.. _`documentation`: http://fr.php.net/manual/en/function.gettext.php
+Another workaround is to use `Twig Gettext Extractor`_ and extract the template
+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/
Something went wrong with that request. Please try again.