Skip to content
Self-Evident edited this page Aug 3, 2012 · 4 revisions
Clone this wiki locally

Welcome to the OneFileCMS wiki!

For the moment, see the readme for general information.

Question: Should external language files be .ini or .php file formats?

Objectives: Language strings must be able to contain any normal "text",
including the various quotes and other punctuation.
Consistancy of language file contents -vs- format/contents of Default_Language().
Ease of copy/paste from external language file to Default_Language() in onefilecms.php.

The default language settings are contained directly in onefilecms.php
Language files will rarely be modified.
Language files might be edited by non-programmers.
Users of OneFileCMS are neccessarily programmers.

ini pro: easier to read.
ini pro: Quotes not needed around values (but are generally recommended).

ini con: If quotes are not used around values, unexpected results can occurr if not careful.
(reserved words & special characters)
ini con: While simple and few, some values may be converted to different values on parse (on, boolean, etc).
ino con: The behavior of the prior point is inconsistant in different php versions.
ini con: Different escaping requirements between .ini & .php.
ini con: In php < 5.3, double quotes can not be in a value, escaped or not.
ini con: In php < 5.3, Single quotes around a value become part of the value.
In later versions, single quotes simply quote the value as expected.
ini con: In php < 5.3, parse_ini_string is not available, so additional code
that uses a temp file is needed to read Default_Language() values.
ini con: Can't simply copy & paste the contents of a langauge ini file into the
return value of Default_Langauge(), as singe quotes in values must be
escaped in _Default(), but not in the .ini file.

php pro: Can copy & paste directly between config.php or OneFileCMS.LANG.xx.php and
onefilecms.php, without any worry of format or version differences.
php pro: When using single quotes, no conversion or expansion of values.
php pro: More flexible- may use single or double quotes in all php versions.

php con: Using double quotes can have different results than using single quotes.
(However, this can also be a pro if needed)
php con: Slightly more difficult to read, due to the extra syntax.