Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Appending text in compiled php file

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
ssontakke
Smarty n00b


Joined: 23 May 2018
Posts: 2

PostPosted: Tue Jun 05, 2018 8:38 am    Post subject: Appending text in compiled php file Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1572

PostPosted: Tue Jun 05, 2018 1:58 pm    Post subject: Reply with quote

Sorry, but your explanation does not match heads to tails.
At the very least, it sounds rather backwards.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1572

PostPosted: Tue Jun 05, 2018 2:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
ssontakke
Smarty n00b


Joined: 23 May 2018
Posts: 2

PostPosted: Tue Jun 05, 2018 2:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1572

PostPosted: Wed Jun 06, 2018 3:06 pm    Post subject: Reply with quote

Then rig your "similar" tool to allow harvesting of the strings you need.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP