krashchiy
-
Posts
2 -
Joined
-
Last visited
Posts posted by krashchiy
-
-
I have a couple of questions.
First, in script 14.4 transliteration does not work. Namely, the function str_translitearte() is undefined. I checked on the web and it looks like this function does not exist. I updated my library to include internationalization package and so far I had no problems (even with Collator) but this function is nevertheless undefined. In php manual I was able to find transliterator_transliterate() function but it looks like this function is in its development, for no arguments and implementations are given. Can you give some advise on how I can have the function to work? My php version is 5.3.8.
Second, in script 14.5 locales, strtotitle() and date_format_locale() are undefined. As I understand these functions did not come to existence yet since no PHP 6 is released. However, I tried to follow advise on Book's sidebar "Locales in PHP 5" and used a setlocale() function, which did not work as well. Is there an alternative solution? Thank you in advance.
Chapter 14 Transliteration And Locale
in PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
Posted
I still vaguely understand how to implement transliterator method. I guess, I have to construct a transliterator object first but I don't know how to perform this task. As for the locale script, I got it to work without errors but it does not show any other locales except for the default one. Here's what I've tried so far:
<?php
//Set the default timezone:
date_default_timezone_set('UTC');
//Need a date object:
//$d = new DateTime();
//Create a list of locales:
$locales = array ('en_US', 'fr_FR', 'es_BO', 'zh_Hans_CN', 'ru_RU',
'el_GR', 'is_IS');
//Print the date in each locale:
foreach ($locales as $locale){
//Set the locale:
locale_set_default($locale);
//Print the date:
setlocale(LC_ALL, $locale);
echo "<p>$locale: ".
strftime('%A, %#d %B %Y'). "</p>\n";
}
?>