Best way to translate month names
codeigniter, php, time
Solution
You can use `str_ireplace()` with arrays for names in english, and equivalent for names in turkmen, in same order.
Something like this:
$nmeng = array('january', 'february', ..);
$nmtur = array('ocak', 'subat', ...);
$dt = 'September 22, 2012';
$dt = str_ireplace($nmeng, $nmtur, $dt);
Problem
I am using Codeigniter! What will be the best way to translate month names. I have a date in mysql timestamp like this: `2012-09-22 11:21:53` I can convert it to `'September 22, 2012'` with php `date()` function. I want to rename `'September'` to `'Sentýabr'`. Can set_locale() function can do this. By the way it is `Turkmen Language`. thank you. OK , i created some php file to check it indivudally like this: cool.php ``` <?php setlocale(LC_ALL,'ru_RU'); echo strftime('%B',time()); ?> ``` Returns September. What might be the problem. I have ``` /* Set locale to Turkmen */ setlocale(LC_ALL, 'tk'); ``` And ``` echo strftime( '%B',time()); ``` Result: returns September I need it return September in my language