Localization in php, best practice or approach?
- by sree
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!!