|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
ssontakke Smarty n00b
Joined: 23 May 2018 Posts: 2
|
Posted: Tue Jun 05, 2018 8:38 am Post subject: Appending text in compiled php file |
|
|
Our urls are like - /?module=login
We want some way to identify module-login in the compiled php file.
Context: for internationalization, our tpl would have code something like this:
<h1>__( ‘Hello’) </h1>
We want extract all keys for translation. We thought of parsing compiled tpl file and extract all keys between __() function. We need a way to link the extracted translation keys and module name.
Can you help? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jun 05, 2018 1:58 pm Post subject: |
|
|
Sorry, but your explanation does not match heads to tails.
At the very least, it sounds rather backwards. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jun 05, 2018 2:01 pm Post subject: |
|
|
Though, said that, why don't you use gettext? I believe it has the means of presenting the data you are looking for. |
|
Back to top |
|
ssontakke Smarty n00b
Joined: 23 May 2018 Posts: 2
|
Posted: Tue Jun 05, 2018 2:18 pm Post subject: |
|
|
My apologies for not explaining it correctly at first place.
The __() is alias for something similar to gettext(). gettext() requires a translation table. My task is to create that translation table for all existing keys present in all tpls.
We need to parse all existing tpls, find all __( ‘KEY’ ) present in tpls and insert those KEYs in database. The keys needs to be stored against the module name in the url /?module=login. All this extraction work would be done statically on tpl or tpl compiled php files. So I want a way to append a small text in all compiled files, something like - {*module-login*} appended to all compiled tpl files.
So when the KeysExtractorScript will extract the keys, it knows against which module it needs to store that keys in translation table. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Jun 06, 2018 3:06 pm Post subject: |
|
|
Then rig your "similar" tool to allow harvesting of the strings you need. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|