Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smarty support #126

Open
aolko opened this issue Sep 2, 2016 · 3 comments
Open

Smarty support #126

aolko opened this issue Sep 2, 2016 · 3 comments

Comments

@aolko
Copy link

aolko commented Sep 2, 2016

Why you're ignoring smarty? Please support it.

@oscarotero
Copy link
Member

I'm not familiarized with smarty, but if you want to work in a pull request, I'd happy to include it.

@dusta
Copy link

dusta commented Mar 9, 2017

@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

@daheadcracker
Copy link

daheadcracker commented Sep 20, 2018

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants