intl

List of available collators in PHP?

a 夏天 提交于 2019-12-28 16:06:06
问题 I am considering using collators in PHP (I am no expert in PHP). Is there a way to know/list all collators available in PHP? I am looking for something similar to Java's Collator.getAvailableLocales(). Thanks. 回答1: I think the Collator is using the locale information from the CLDR repository. I compiled a list from it's current trunk: af af_NA af_ZA ar ar_001 ar_AE ar_BH ar_DZ ar_EG ar_IQ ar_JO ar_KW ar_LB ar_LY ar_MA ar_OM ar_QA ar_SA ar_SD ar_SY ar_TN ar_YE as as_IN az az_Latn az_Latn_AZ be

locale_get_default() function issue on localhost

让人想犯罪 __ 提交于 2019-12-25 02:39:08
问题 Im using wampserver on localhost with; PHP 5.3.13 Apache 2.2.22 Enabled php_intl.dll extension But i got following error while using locale_get_default() function Fatal error: Call to undefined function locale_get_default() in Or using Locale::getDefault() function Fatal error: Class 'Locale' not found in 回答1: snip didnt read: Are you sure the extension is loaded? (See phpinfo(); ) 回答2: Solved with Following Link http://forum.wampserver.com/read.php?2,80704,116793 Ok, I got it to work. It

Update ICU extension within xampp?

梦想与她 提交于 2019-12-23 03:07:10
问题 I'm running xampp and I need to upgrade ICU (php_intl extension) to the latest version - I downloaded 54 from the ICU page but unsure how to go about upgrading it. There is a bin , include and lib folder - where do I put these files and do I have to do anything else? 回答1: To upgrade existing ICU in you XAMP installation you'll need to: copy php_intl.dll to your_xamp_folder/php copy all the icu*.dll files to your_xamp_folder/apache/bin check if extension=php_intl.dll is enabled in your_xamp

PHP - support for multibyte safe regular expressions

梦想的初衷 提交于 2019-12-22 09:34:35
问题 PHP supports regular expressions in three ways: POSIX ERE, now removed in PHP 7+ PCRE which is a core component, but not always multibyte safe Multibyte String, which is not enabled by default Today the web is Unicode, and PHP is too since 5.6 because of i18n. While PHP itself is known to be abysmally bad in supporting Unicode, Intl provides access to the relieving ICU library. To avoid the long wait for UString and repetition (and memory) when doin' it right, I prefer Intl and leave out

Converting non-Gregorian dates using IntlDateFormatter

↘锁芯ラ 提交于 2019-12-22 08:19:41
问题 How should I convert a non-Gregorian date to other calender types using IntlDateFormatter . I want convert "1392-01-02" from persian to islamic calender. I tried the following code but it does not convert the calendar: $formatter = IntlDateFormatter::create('en_US@calendar=persian', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Tokyo',IntlDateFormatter::TRADITIONAL,'yy-MM-dd'); $formatter->setCalendar(IntlDateFormatter::GREGORIAN); echo $formatter->format($formatter->parse("1392-2

Php-intl installation on XAMPP for Mac Lion 10.8

感情迁移 提交于 2019-12-19 11:18:11
问题 Hi folks i am trying to install intl library on xampp for mac. I have installed php 5.3, so i just copied intl.so file from the php 5.3 location to Xampp bin folder. After that i uncommented extension=intl.so and restarted the server. Still i dont see intl updated in the phpinfo() (Getting error Class Locale not found) 回答1: I just ran this in Terminal. sudo pecl install intl Then just add extension=intl.so to php.ini . 回答2: For me this worked (php 7.1, MAMP, macOS Mojave): Downloaded the intl

How to install the Intl extension for Twig

≡放荡痞女 提交于 2019-12-17 15:33:12
问题 The Intl extension is an extension for Twig that adds the localizeddate , localizednumber and localizedcurrency filters. How can I install and set up the extension so that I can use those filters in my Twig templates? 回答1: Install the PHP intl extension First of all, you will need the PHP intl extension, as the Twig extension is built on top of that. The Twig Intl extension will throw an Exception if the PHP intl extension is not enabled. Installation instructions can be found in the official

intl extension: installing php_intl.dll

…衆ロ難τιáo~ 提交于 2019-12-17 02:27:17
问题 I'm trying to locate php_intl.dll and install it. Does anyone have any tips? 回答1: The packages at http://windows.php.net/download/ all contain the php\_intl.dll which is located in the subdir ext/ . All you have to do is to check if your extension_dir points to the right directory and add (or uncomment) the extension=php\_intl.dll directive. 回答2: For the php_intl.dll extension to work correctly, you need to have the following files in a folder in your PATH : icudt36.dll icuin36.dll icuio36

Get currency ISO 4217 code based on locale

橙三吉。 提交于 2019-12-12 20:36:10
问题 Say, if I parse HTTP Accept-Language header with Locale::acceptFromHttp is there an easy and reliable way to get user's preferred currency based on this locale identifier? Like "USD" for "en-US". I wish there was a way to do this with PHP intl extension but so far was unable to find my answer in the manual. I saw Zend Framework can do this with Zend_Currency but it's just too bloated for my particular software. Any other libs or ways of achieving this? Since there must be a lot of locale

Manipulate the list of countries provided by Symfony Intl and the form choice type

一曲冷凌霜 提交于 2019-12-12 16:15:59
问题 Politics aside, I need to provide Kosovo as a form choice when selecting a country. What's the most elegant way of doing this with Symfony's built-in form choice type country , while also providing translations for the Kosovo name? Here's what I've done so far and it works but I'm concerned this might be a bit hack-ish. <?php namespace Acme\Bundle\DemoBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component