Current time: 04-17-2024, 04:11 AM Hello There, Guest! (LoginRegister)


Post Reply 
Thoughts about moving translation call to inside gui template
Author Message
kassah Offline
Junior Member
*

Posts: 46
Joined: Oct 2010
Reputation: 1
Post: #1
Question Thoughts about moving translation call to inside gui template
As I have been exploring making a new theme, I noticed that I am restricted to strings that are passed to the smarty template.

I'm just pondering if you'd be open to moving the tr("string") call from the PHP files into the templates themselves (making a callback in the pTemplate engine for dealing with it).

I'd be happy to make up the bug & patch for it, just want to check into the community for 1. would the developers like such a thing 2. would this overwhelmingly screw up those who already made custom templates?

Thanks,
Will

Edit: Changed question to apply to pTemplate per sci2tech's response below.
(This post was last modified: 10-31-2010 04:01 AM by kassah.)
10-31-2010 02:23 AM
Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #2
RE: Thoughts about moving translation call to inside gui template
We do not use smarty Tongue. It`s pTemplate Wink
10-31-2010 03:47 AM
Visit this user's website Find all posts by this user Quote this message in a reply
kassah Offline
Junior Member
*

Posts: 46
Joined: Oct 2010
Reputation: 1
Post: #3
RE: Thoughts about moving translation call to inside gui template
(10-31-2010 03:47 AM)sci2tech Wrote:  We do not use smarty Tongue. It`s pTemplate Wink

Huh... you're right what do ya know! =P

Looking over it (I could be wrong), but it doesn't look like it would be to hard to add a callback setup for dealing with translations. Course it doesn't change the core of the question =).
10-31-2010 03:59 AM
Find all posts by this user Quote this message in a reply
kassah Offline
Junior Member
*

Posts: 46
Joined: Oct 2010
Reputation: 1
Post: #4
RE: Thoughts about moving translation call to inside gui template
(10-31-2010 03:47 AM)sci2tech Wrote:  We do not use smarty Tongue. It`s pTemplate Wink

Did up a quick example patch:
  • Adds callback functionality to pTemplate class
  • Adds a TR callback to gui/client/index.php and removes the General Information string from the hardwired set.
  • Changes {TR_GENERAL_INFORMATION} to {TR:"General Information"} in the client/index.tpl template.

You can see my changes at my github as well:
http://github.com/kassah/ispCP/commit/83...78e9ce300b
(Keep in mind this is the second of two commits, the patch attached to the forum post includes both, first one fixes a bug)


Attached File(s)
.patch  pTemplate-inline-translation.patch (Size: 3 KB / Downloads: 3)
(This post was last modified: 11-05-2010 09:03 AM by kassah.)
10-31-2010 06:30 AM
Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #5
RE: Thoughts about moving translation call to inside gui template
Why you want do this change? See that your modification break automated string extract used for po creation (not a big deal, script can be rewritten).
BTW, If you want to involve more, I`ll propose you for dev team.
10-31-2010 06:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
kassah Offline
Junior Member
*

Posts: 46
Joined: Oct 2010
Reputation: 1
Post: #6
RE: Thoughts about moving translation call to inside gui template
(10-31-2010 06:43 AM)sci2tech Wrote:  Why you want do this change? See that your modification break automated string extract used for po creation (not a big deal, script can be rewritten).

Well it just frees me up on custom theming, I don't have to be limited to the strings that the php gives me, instead I can grab the ones I want in the template.

(10-31-2010 06:43 AM)sci2tech Wrote:  BTW, If you want to involve more, I`ll propose you for dev team.

I do want to be involved more, but I don't want to be on the dev team just yet. This is my second week messing around with ispCP, and only second day really wading into the code. The reason for my initial flurry of activity is trying to bring ispCP features wise up to around where Plesk is (or at least the features my customers use), so that I can move my hosting company over to it. Of course, I want to get as many of those features accepted into stock ispCP, so I have less to maintain on the side by myself Big Grin.

Once I've moved my company to actually using it, then I would love to revisit becoming a dev. Because then I will have a lasting interest in ispCP Smile

Also, my goals for my move are very pointed, and they may not match up with ispCP's long term goals. You guys might want to be able to sort through my patches and understand what you actually want to add to ispCP, and what doesn't match your mission =).

All that being said, if there is something you want attention to, but don't have time. I'd be happy to drop some attention on it Smile.
10-31-2010 07:13 AM
Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #7
RE: Thoughts about moving translation call to inside gui template
From my point of view, should not be a problem to add your patch.
The only problem will be that po generation will take longer because theme files must be parsed too for strings needed to be translated. Lets wait other devs opinion (especially Nuxwin which is Dev Team leader).
10-31-2010 07:21 AM
Visit this user's website Find all posts by this user Quote this message in a reply
kassah Offline
Junior Member
*

Posts: 46
Joined: Oct 2010
Reputation: 1
Post: #8
RE: Thoughts about moving translation call to inside gui template
I did notice there is a Smarty branch, might be worth waiting on them depending on their timeline. I am not a paticular fan of Smarty, but it does make some things easier. I generally clone ZF's template system, just phtml files (i.e. php files with lots of html). The more advanced you get with Smarty stuff, the harder it becomes to debug.

Ref: Convert pTemplates into Smarty Templates
(This post was last modified: 11-03-2010 01:17 PM by kassah.)
11-03-2010 01:12 PM
Find all posts by this user Quote this message in a reply
zpin Offline
Junior Member
*****
Dev Team

Posts: 160
Joined: Sep 2007
Reputation: 1
Post: #9
RE: Thoughts about moving translation call to inside gui template
If you consider making a theme I'd definitely wait for the Smarty change. It should make your life much easier. Getting translations inside the templates is also something we've been talking about when doing the Smarty conversion and it would be pretty easy to implement (there already seems to be a Smarty gettext plugin).

The branch is ready for use, the only thing missing is some serious testing by people other than the ones working on it Smile Then it could be reintegrated. There's of course other stuff we can and will do on the Smarty side, but the task of converting the templating system 1:1 has been complete for a while now.
(This post was last modified: 11-03-2010 09:06 PM by zpin.)
11-03-2010 09:05 PM
Find all posts by this user Quote this message in a reply
kassah Offline
Junior Member
*

Posts: 46
Joined: Oct 2010
Reputation: 1
Post: #10
RE: Thoughts about moving translation call to inside gui template
(11-03-2010 09:05 PM)zpin Wrote:  The branch is ready for use, the only thing missing is some serious testing by people other than the ones working on it Smile Then it could be reintegrated. There's of course other stuff we can and will do on the Smarty side, but the task of converting the templating system 1:1 has been complete for a while now.

Well... see... now... when I cloned out svn to git, I didn't grab branches, stupid me! I'll have to remedy that and give your branch some work. I'm already tracking and syncing trunk with my own internal branch for my theme.
11-04-2010 12:49 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)