Gettext
Gettext copied to clipboard
Smarty support
Why you're ignoring smarty? Please support it.
I'm not familiarized with smarty, but if you want to work in a pull request, I'd happy to include it.
@aolko its working with https://github.com/smarty-gettext/smarty-gettext
edit I do not know why but when I edit language i must restart php
@aolko @dusta
I do not know why but when I edit language i must restart php
You just need to copy the block.t.php
file to the smarty plugin directory. The function.locale.php
file is loading the php gettext extension, which caches the .mo files at apache start. But you don't need the that if you are using oscarotero's script. So just copy the block.t.php
file to the plugin folder and you are done. Maybe adjust the original gettext functions to the one's recognised by oscarotero's script. E.g. change line $text = gettext($text);
to $text = __($text);
in the block.t.php
file.
@oscarotero
I've written a "function scanner" for smarty tpl files. It's kinda hacky but works for single strings with the smarty {t}MY STRING{/t} syntax. No comments and plural forms are implemented yet.
Usage:
Gettext\Extractors\Tpl::fromFile($file_path, $translations);
gettext.zip