Localization in php, best practice or approach?
Posted
by
sree
on Programmers
See other posts from Programmers
or by sree
Published on 2012-04-09T07:11:45Z
Indexed on
2012/04/09
11:47 UTC
Read the original article
Hit count: 350
php
|localization
I am Localizing my php application. I have a dilemma on choosing best method to accomplish the same.
Method 1: Currently am storing words to be localized in an array in a php file
<?php
$values = array (
'welcome' => 'bienvenida'
);
?>
I am using a function to extract and return each word according to requirement
Method 2: Should I use a txt file that stores string of the same?
<?php
$welcome = 'bienvenida';
?>
My question is which is a better method, in terms of speed and effort to develop the same and why?
Edit: I would like to know which method out of two is faster in responding and why would that be? also, any improvement on the above code would be appreciated!!
© Programmers or respective owner