-
-
Notifications
You must be signed in to change notification settings - Fork 272
I18n: Option to specify alternatives for gettext / ngettext (extension config?) #152
Comments
I want to use Twig_Extensions_Extension_I18n with oscarotero/Gettext as well. With pull-request #166 I can easily switch between using gettext and oscarotero/Gettext depending on whether the first exists and works, without forking Twig_Extensions_Extension_I18n. Only Twig_TokenParser_Trans and and Twig_Node_Trans need to be changed for our needs though. |
Remove if twigphp/Twig-extensions#166 is merged or otherwise twigphp/Twig-extensions#152 is solved.
This needs to be fixed. Being restricted to PHP's gettext extension is a show-stopper for anyone taking translations seriously, not only because the gettext extension is not thread-safe, but also because it requires you to install all the locales you may need on the server, and that's a huge issue when you don't even have access to the server. So basically there should be a way to specify which functions you want to use for translations, provided they have the same signature as the original Since this repository looks a bit unmaintained, I've just created an extension on top of this that solves the problem for the current version and hopefully also for future updates, if any. Using it is extremely simple, it does not require modifications to the templates, and just a minimal modification to the script loading and displaying them. |
[offtopic, alternative] If you use symfony or Silex, it is also possible to use symfony/framework-bundle(for extracting), symfony/twig-bundle and symfony/translation. |
see #193 |
As explained by me on php-gettext/Gettext#82 (comment):
FYI, Gettext/Gettext functions are located here:
https://github.com/oscarotero/Gettext/blob/master/src/translator_functions.php
The text was updated successfully, but these errors were encountered: