-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Error in locale system w/ LocaleType and CountryType #5279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have the same problem with the CountryType. Same thing happens for the "nl" locale. The country resource bundle could not be loaded for locale "en" |
Do you have the intl extension installed? |
I do, yes. PHP 5.3.15, intl Internationalization support => enabled Directive => Local Value => Master Value |
The config.php file doesn't report I should install it, so it should be. |
Try using nl_NL and en_US. |
The locale resource bundle could not be loaded for locale "en_US" No dice. Any other ideas? |
https://github.com/symfony/Locale/tree/master/Resources/data Version 42 is not present, I don't know if this is a problem. Try running php build-data.php 42 in the Locale / Resources / data directory to build the data for your version. |
Installed libicu-devel to get icu-config. Then: -bash-4.1$ php build-data.php 42 ; ICU data source URLs On a hunch: -bash-4.1$ php build-data.php 49 Which DID fix the issue. Not sure if it was installing icu, icu-devel or doing the rebuild, but it seems to be working now. Any guesses? |
Additional testing, rebuilding 49 resolved it. (I reset the repo). I hope this helps figure out what's going on? |
I'm getting the same error but the above steps didn't resolve it. |
I have the same problem, and the above steps didn't worked. |
ping @eriksencosta |
@jmather please, try:
Then run the tests. |
Running
Fixed the issue for us. |
@eriksencosta Sorry for the delay. Just to try everything possible, I ran it on both 4.2 (first) and 49 (second). Here are my results: -bash-4.1$ php build-data.php 4.2 -bash-4.1$ phpunit Configuration read from /vendor/symfony/symfony/src/Symfony/Component/Locale/phpunit.xml.dist EEE............................................................ 63 / 935 ( 6%) Time: 0 seconds, Memory: 11.25Mb There were 3 errors:
/vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php:54
/vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php:109
/vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php:160 There were 17 failures:
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php:481
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:164
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:164
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:164
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235 FAILURES! -bash-4.1$ php build-data.php 49 -bash-4.1$ phpunit Configuration read from /vendor/symfony/symfony/src/Symfony/Component/Locale/phpunit.xml.dist ............................................................... 63 / 935 ( 6%) Time: 1 second, Memory: 11.75Mb There were 17 failures:
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php:481
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:164
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:164
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:164
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235
/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php:235 FAILURES! |
Just a reference point, this is also happening out of the box for my Pagoda setup as well, so I've verified it across a few implementations. Unfortunately, with Pagoda, rebuilding distributed lib files isn't really an option. |
@jmather Sorry man, I forgot (as in the README file):
The |
|
Thank you man! Now it's time to fix this timezone issue! |
@fabpot This issue can be closed. |
Glad I could help! |
@jmather Can you please paste here the output of the
|
It doesn't look like I have access to it. CentOS 6.3, icu-4.2.1-9.1.el6_2.i686 |
had the same issue, when i try with
|
@pborreli You need PHP with the intl extension enabled and the ICU tools installed in your environment to build the ICU data. Please, read the UPDATE.txt for more info. |
@jmather Ok man, thanks! |
@eriksencosta need it for https://symfony.ci.cloudbees.com/job/Symfony2/job/Symfony2-master/42/console gonna ask them if they can install it, thanks. |
I'm still seeing this issue with the latest update. Is there anything more I can do to help confirm/test? |
As an update to anyone following this: Add the following to your /etc/init.d/httpd file:
I'm not sure why this needs to be done to tell the Locale extension to use the version of ICU available to it, it seems a little .. strange. I've put a feeler out in #symfony-dev and will prepare a PR if I don't hear from someone soon. |
sorry guys , im newbie... excuse me but I am very confused |
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:156
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508
/home/ubuntu/NetBeansProjects/infrattoniNew/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php:508 FAILURES! |
I would like to thank you, @weaverryan, for trying to eloquently say what I think I have been intending to say all along. That this doesn't work, out of the box, on any system other than a 'version 49 whatever' is a bug. Plain and simple. I don't really care if we need to detect a system library difference and make a script run to compile the correct pieces, or what, but something needs to get changed, because the solution being 'defining an environmental variable and manually recompiling the data set because you found this issue while searching for the error' is an awful solution. We must strive to be more user-friendly, or people will simply omit the features that rely on these bindings, which negates a lot of work people have done in getting this stuff working. |
WTF
I don't want to install svn! :| |
Well you need it if you want to build that data... |
For those who need those data (and don't want to build them), here is a repository containing v4.2 of the processed ICU files : https://github.com/kbsali/sf2-icu |
Hello !! Is there any development planned on SF side to avoid this error ? Thanks |
@vwasteels have you checked https://github.com/kbsali/sf2-icu ? |
Totally agree with @jmather. Thing is, this issue is marked as closed, so presumably it isn't getting much attention. |
Hi, Are there any one who had a solution for this issue ? thanx |
Ok, finally it works after following instrunctions in https://github.com/kbsali/sf2-icu Just, you should edit /vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php and change the const version to 4.2 instead of: It's a bad solution, because, i edited symfony source file ! i think that, Sensio should give us a solution for this problem. For example, the default version should be 49, but if exceptions occurs, the method should try to get the 4.2 version, if exception persists, we launch it. I hope this help you. Waiting for fixing this issue, be careful, when updating you application using composer. |
Use this to inform the Locale component. export export USE_INTL_ICU_DATA_VERSION=true Then define the following constant in php. if (!defined('INTL_ICU_DATA_VERSION')) {
define('INTL_ICU_DATA_VERSION', '4.2');
} |
Hi, |
i had to adjust (Using centos and icu 4.2.1 installed). |
So where are we at here? Is this "fixed", do we have a cookbook entry? |
I think I know how to get us to a 'better spot' even though it may not just be 'fixed' yet. I think we should remove the requirement of the environment variable override, since data for the wrong version won't work anyway, so we may as well make it easy to switch versions. Then we should do a manual check to make sure we can access the data files, and if not, throw an exception pointing them to a web page which describes how to rebuild the data files. Bonus points if we can provide a place to just download zips of the compiled data files. Extra bonus points if we can get ICU version detection into composer (there's been conversations w/ @Seldaek about this on twitter) so that it just automatically installs the right one when you Ok, so I negated the last "Extra bonus points" w/ that caveat -- so Extra bonus points go for a set of scripts to run post-[ install | update ] and manually to apply the correct version of the ICU data files from a precompiled source. I think this would actually be considered 'fully fixed' as far as this issue is capable of being fixed. I would offer to do this but simply do not have the time. I wanted to write up my over-all thoughts on this as I had raised it with @fabpot at SunshinePHP and we'd essentially left it at "well, hm, we'll have to think about that." |
lib-ICU gives you the ICU version in composer |
I'm currently working on a fix for this issue. |
Perhaps the issue status should not indicate 'CLOSED' :) |
👍 to re-opening the issue until it's really fixed! |
@bschussek is that component split the fix for this issue? I feel that won't be merged for a long time, so this bug fix will be left hanging. Is there something quicker that can be done to fix this? |
@bendavies I hope that the component split will be merged in the next couple of days. |
This PR was merged into the master branch. Discussion ---------- [Intl] Refactored Locale component into two new components Icu and Intl | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | yes | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #5279 | License | MIT | Doc PR | symfony/symfony-docs#2312 The Intl component is now a simple drop-in replacement layer for the C intl extension. Install it via Composer and have it available automatically if the intl extension is not available. Additionally, the component ships data from the ICU library which can be accessed through the methods: ```php use Symfony\Component\Intl\Intl; Intl::getCurrencyBundle()->... Intl::getLanguageBundle()->... Intl::getLocaleBundle()->... Intl::getRegionBundle()->... ``` If the intl extension is installed, Composer will install the ICU data for the ICU version in the intl extension. If the intl extension is not installed, Composer will use stub ICU data for the latest ICU version (see `Intl::getStubIcuVersion()`). See the [README](/bschussek/symfony/blob/intl/src/Symfony/Component/Intl/README.md) for more information. Todo: - [x] finish the Intl README file - [x] update the Icu README file - [x] update the documentation - [x] make parameter `$locale` optional (default to `\Locale::getDefault()`) in resource bundle methods - [x] remove `(Icu)?Version::compare` calls in the tests - [x] solve deployment problem when trying to install incompatible symfony/icu version listed in composer.lock Create the following branches in the [Icu component](https://github.com/symfony/Icu): - [x] 1.0.x - [x] 1.1.x - [x] 1.2.x Commits ------- 9118b4a [Locale] Removed "Stub" prefixes in Intl component b4cccfd [Intl] Removed "Stub" prefix from stub classes 60f31d1 [Intl] Improved inline documentation c2d37e6 [Intl] Improved error messages in the build scripts 1249f01 [Intl] Added scripts to test the compatibility of various versions of symfony/icu with the ICU version installed on the system 9dbafd7 [Intl] Split update-stubs.php script into two scripts to function with the changed Icu component versioning e2c11cb [Intl] Added a check for the ICU data version to IntlTestHelper to prevent the stub class tests from failing 427d24a [Intl] Outsourced bundle reader creation to Icu component 0160fd5 [Intl] Moved stub data to Icu component 1.0.x dbca3b7 [Intl] Added empty directory needed for the tests a717ce9 [Intl] Removed ICU version comparisons from the tests 5d17de5 [Intl] Fixed version comparisons in the transformation rules 470927d [Intl] Improved build scripts aceb20d [Form] Improved tests to use the IntlTestHelper class 3dd75ff [Locale] Improved tests to use the IntlTestHelper class 03b78b0 [Validator] Improved tests to use the IntlTestHelper class 9d9c389 [Intl] Simplified tests c55c4a2 [Intl] Only the StubNumberFormatterTest requires stub data 17a480b [Intl] Added IntlTestHelper class for convenience 1dcdcd3 [Locale] Fixed failing tests f6b75b9 [Intl] Changed composer.json to disallow future versions of the Icu component 080c880 [Intl] Bumped the stub version to 50.1.2 dd2d013 [Intl] Improved the bundle compilation process f47e60a [Intl] Fixed small bugs in the resource bundle transformation 467cc93 [Intl] Fixed various problems in the resource compilation process 4a5c453 [Intl] Moved the content of the README file to symfony/symfony-docs 9899de7 [Intl] Updated the README bfec58a [Intl] Fixed flawed PHPDoc 21323ba [Intl] Updated the README file 209a9cb [Validator] Adapted to latest Intl changes f2a0aec [Form] Adapted to latest Intl changes 0f6277f [Locale] Adapted to latest Intl changes 2cd1be8 [Intl] Made the $locale parameter optional in the bundle interfaces b9e9cb2 [Intl] Added autoload.php which was ignored by .gitignore 838798f [Intl] Removed method IntlTestCase::skipIfInsufficientIcuVersion() dde1d34 [Intl] Changed Intl::getIcuVersion() to return the stub version if the intl extension is not loaded 99f6f8a [Form] Fixed failing tests 5d0b849 Fixed PHPDoc b60866c [Intl] Changed Intl::getStubIcuVersion() to Intl::getIcuStubVersion() b902b6b [Locale] Added default locale 01d0ee8 [Validator] Changed component to use the Intl component 0c1fe39 [Form] Changed component to use the Intl component 5917a2e [Intl] Refactored Locale component into two new components Icu and Intl
Hi guys! As for me solution with version 4.2 not good, because, for example I had 3.8.1. and I don't like to change symfony src files You should:
I hope my comment helps |
@kalinick I just added support for ICU 3.8 to the Icu component. |
Using #5279 (comment) and a pre-compiled version of the resource files for 4.2 from https://github.com/kbsali/sf2-icu I got it to work on a Bluehost shared hosting server where I couldn't recompile the resource files. |
I have been receiving:
The locale resource bundle could not be loaded for locale "en"
when trying to include a Locale type field in a form.
I have also seen a report of someone having the same issue with CountryType:
The country resource bundle could not be loaded for locale "en"
Anything we should check?
The text was updated successfully, but these errors were encountered: