By default, PHP displays timestamps in English. Since SimplePie's get_date() method relies on PHP's date() function, get_date() is English-only. However, in SimplePie 1.0 we introduced get_local_date() which leverages PHP's strftime() function which is designed to translate timestamps into other languages.
get_local_date() accepts values that are accepted by strftime(). We also need to call PHP's setlocale() function prior to using this method. setlocale() has it's own set of issues with region/language codes. It only supports whatever is installed in your PHP installation, and some servers require two or three-letter codes.
This will ONLY work for items that have timestamps.
- Supported in SimplePie 1.0.
- Code in this tutorial should be compatible with PHP 4.3 or newer, and should not use PHP short tags, in order to support the largest number of PHP installations.
tutorial/translate_timestamps_into_another_language.txt · Last modified: 2011/03/05 19:56 (external edit)