Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[2.2] [Locale] add StubResourceBundle #4081

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

Closed
wants to merge 1 commit into from

Conversation

stealth35
Copy link
Contributor

Bug fix: yes (missing feature)
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
  • Support res file, version 1.2
  • Few change :
    • Locale::getFallbackLocale is now public
    • Skip the StubCollator in Locale::getDisplayLanguages, getDisplayLocales, getDisplayCountries
<?php
$collator = new \Collator(!extension_loaded('intl') ? 'en' : $locale);

Next Step : I think this can be useful for StubIntlDateFormatter

@@ -11,6 +11,7 @@ if (!function_exists('intl_get_error_code')) {
$loader->add('Collator', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs');
$loader->add('Locale', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs');
$loader->add('NumberFormatter', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs');
$loader->add('ResourceBundle', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add this in the composer.json files too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah sorry, the stub is not in composer because the functions cannot be autoloaded

@fabpot
Copy link
Member

fabpot commented Apr 24, 2012

ping @eriksencosta

* @author stealth35
* @see Symfony\Component\Locale\Stub\StubResourceBundle
*/

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docblock is misplaced. It should be before the class declaration line.

@mvrhov
Copy link

mvrhov commented Apr 25, 2012

@eriksencosta you probably missed my update. In that same PR the format switch does still make files icu 4.2 is unable to read.

@stealth35
Copy link
Contributor Author

@eriksencosta Thank, the ICU res, is a docless format, but now I fully understand it

I think this is a new feature. If you think this is a bug, you should PR for the the 2.0 branch

It's a missing feature, when this PR will be OK for all, we could merge this in the 2.0

Do you think it will be hard to update this later for ICU 4.8?

Yes and No,
No, there is just new resource type, TABLE16, STRING2 ...
Yes, the swapping resource (in STRING2) seem to be tricky

There is also the dat format (work like the tararchive)

It would be good to create a script to update the binary fixture files

I have made the Translation IcuResDumper, but it's only work for the string
I need a txt resource reader (work like json), and after I can create a ResourceBundleWriter (IcuResBundle can use it), and also a ResourceBundleReader (StubResourceBundle can use it) for more resource information : version, unicode version, encoding ...

@fabpot
Copy link
Member

fabpot commented Apr 26, 2012

Ping me when everybody thinks this is mergeable.

@ghost
Copy link

ghost commented Apr 30, 2012

@stealth35 I just think this could have some more tests, specially testing against the intl implementation too since this helps a lot to identify and document the differences in the implementation (as you did when you enhanced the error handling in StubIntl).

And about the script to update the binary files, I was just thinking in calling genrb(), like we did in the update-data.php script. This way me, @igorw or anybody that will try to fix or enhance this stub could easily update the text and binary fixtures files.

@mvrhov Yes, I missed, I was sleepy :)

@fabpot Could we backport this to 2.0 if merged in master?

@fabpot
Copy link
Member

fabpot commented Apr 30, 2012

@eriksencosta If you want this to be in 2.0, the PR must be done on the 2.0 branch.

@ghost
Copy link

ghost commented Apr 30, 2012

@fabpot Ok. So @stealth35, this needs to be made in 2.0.

@fabpot
Copy link
Member

fabpot commented May 15, 2012

@stealth35 Do you have time to make the last changes before I can merge?

@stealth35
Copy link
Contributor Author

@fabpot, sorry I'm busy for now, but it's fonctionnal for the 1.2 format, I'll work with @eriksencosta for the complete intergration of the Stub (think about IntlDateFormatter)

@stof
Copy link
Member

stof commented Jun 9, 2012

@stealth35 @eriksencosta what is the status here ?

@stealth35
Copy link
Contributor Author

@stof I finalize it this next week

@ghost
Copy link

ghost commented Jun 11, 2012

@stealth35 Ping me if you need help. I'll be online on #symfony-dev in the weekend. I have a setup with PHP 5.3.2 and 5.3.13 with ICU from 4.2 to 49.

A good way to have this installed is using phpenv/php-build to easily compile different versions of PHP.

@travisbot
Copy link

This pull request fails (merged c9c494c5 into 7783969).

@travisbot
Copy link

This pull request passes (merged 3f503e20 into 7783969).

@fabpot
Copy link
Member

fabpot commented Jun 28, 2012

@stealth35 @eriksencosta It would be good to have this PR merged before 2.1.0 beta2. Do you know when it will be ready?

correct CS

correct CS

correct CS

prettify getLocales

Add some docs, check the magic number
@travisbot
Copy link

This pull request fails (merged a6f6f6c into 8ebe624).

@stof
Copy link
Member

stof commented Jul 15, 2012

@stealth35 @eriksencosta what is the status here (except for the fact that rebasing is needed) ? 2.1beta2 is already out there, and 2.1beta3 too

@ghost
Copy link

ghost commented Jul 16, 2012

@stof I can only assist @stealth35 on this for now, I am concentrating my time on the ICU data update (#3528) and other minor fixes on Locale.

@fabpot
Copy link
Member

fabpot commented Jul 23, 2012

Rescheduling this PR for 2.2.

@stof
Copy link
Member

stof commented Oct 13, 2012

@stealth35 @eriksencosta What is the status here ? The lack of the ResourceBundle stub means that the CountryType and the LocaleType have a hard dependency to intl currently.

@ghost
Copy link

ghost commented Oct 15, 2012

I'm without free time until late november. I can help after it in time for 2.2.

@fabpot
Copy link
Member

fabpot commented Dec 11, 2012

@eriksencosta Will you have some free time in December to work on this PR?

@ghost
Copy link

ghost commented Jan 6, 2013

@fabpot As I explained on issue #6198, unfortunatelly I could not work on the Locale issues last month. It seems I missed the development phase for the 2.2 release. Can we reschedule this for 2.3?

@fabpot
Copy link
Member

fabpot commented Apr 20, 2013

Looks like this PR is now obsolete (see #7386). @bschussek Can we close this PR?

@webmozart
Copy link
Contributor

Wow, I didn't see someone actually reimplemented ResourceBundle! I'm impressed.

This PR is not obsolete, because #7386 also does not provide a PHP implementation of this class. The code should be moved to \Symfony\Component\Intl\ResourceBundle\Stub\ResourceBundle though.

@webmozart
Copy link
Contributor

@stealth35 Do you think you can make these changes? In how far is your implementation complete?

@fabpot
Copy link
Member

fabpot commented Aug 9, 2013

Closing as it is obsolete now, but I've created an issue to keep track of the code (see #8704).

@fabpot fabpot closed this Aug 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants