#1 2010-08-11 11:05:20

Guardian
Ion Tester
From: Mragowo, Poland
Registered: 2010-08-02
Posts: 133
Website

language file efficiency

Normally we would use something like;
$lang['slogan'] = "language for your future..";

But we know that when PHP sees double quotes it parses the data differently than it would if it were in single quotes, which is why, unless you are manipulating the data dynamically within the quotes, you should always use single quotes wherever possible.

This also works and if you have a large language file, would be far more efficient as far as PHP parsing/interpreting the data is concerned;
$lang['slogan'] = 'language for your future..';

For Ionize, this doesn't really matter because the (theme) language files are very small, I am just making the point in case anyone is developing a very large website and extending the language files significantly.

Of course the negative side is that if you use an apostrophe inside array 'value', you have to escape it;
$lang['slogan'] = 'language\'s for your future..';

Offline

#2 2010-08-11 14:24:59

toopixel
Ionize Core Team
From: Geneva
Registered: 2010-04-20
Posts: 272
Website

Re: language file efficiency

First of, the static languages purpose is to translate very small strings or words, it is not mean to contain variables or whatever php could parse, then as you said, using double quotes will prevent a single quote to break the php parsing, an then this is using CodeIgniter default library, I agree in the future some improvements could be done to this library which is actually a bit too simple.


Too Pixel is a web agency located in Geneva, Switzerland

Offline

#3 2010-08-11 15:13:30

Guardian
Ion Tester
From: Mragowo, Poland
Registered: 2010-08-02
Posts: 133
Website

Re: language file efficiency

I agree completely!
I only mentioned this because on the site I am building, some of the pages will have a right hand column of content and I will be dividing this column into several sections, for example 'Student News, Student Awards etc so by using the language files, I can have all these section headings translated and the owner only has to write the actual content for these area's.
Each area will have it's own 'group' and the view will be set to only show the first paragraph and 'latest' content for each of this groups.
One page I have not build yet will be for classes, so there will be quite a long list of heading text I will need to translate e.g. Beginner, False Beginner, Elelementary.........

The more I work with Ionize, the more I like it!

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations