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

[Intl] Add TimezoneBundle #28831

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@ro0NL
Contributor

ro0NL commented Oct 12, 2018

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets replaces #26851, #17628, #17636
License MIT
Doc PR symfony/symfony-docs#...

This PR compiles a new TimezoneBundle from ICU data, based on the following resources:

The goal is to provide a fixed set of timezones, with a localized human readable name.

For inspiration and to double check some data i used the timezone widget from google, e.g. when using Google Calendar.

I've only pushed some common compiled locales for review, the rest will follow once finished.

cc @jakzal

@ro0NL ro0NL force-pushed the ro0NL:timezone branch from ec63856 to 82db43e Oct 12, 2018

@ro0NL

This comment has been minimized.

Contributor

ro0NL commented Oct 12, 2018

note im not yet convinved about form type integration... if we go that way, we might want an option intl => true to optionally change the source from DateTimeZone::listIdentifiers() to TimezoneBundle

The intl variant IMHO should include, and be sorted by offset, from -xx:00 to +xx:00.

image

here we also see a different format meta - city vs. meta (city), i tend to prefer the latter =/

@ro0NL ro0NL force-pushed the ro0NL:timezone branch 2 times, most recently from 3e3f651 to 0af8f8c Oct 12, 2018

@ro0NL ro0NL changed the title from [Intl][WIP] Add TimezoneBundle to [Intl] Add TimezoneBundle Oct 12, 2018

@ro0NL ro0NL force-pushed the ro0NL:timezone branch from 0af8f8c to 499380f Oct 12, 2018

@ro0NL ro0NL force-pushed the ro0NL:timezone branch from 499380f to 2372fe7 Oct 12, 2018

@nicolas-grekas nicolas-grekas added this to the next milestone Oct 14, 2018

fabpot added a commit that referenced this pull request Oct 25, 2018

feature #28860 [Form] Deprecate TimezoneType regions option (ro0NL)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Form] Deprecate TimezoneType regions option

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #28848
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

I know i've added this option myself in 4.1, but given my recent development for #28624 i realized it's an opinionated feaure, which can/should be solved on user-side (`choice_filter/choice_loader` and/or `group_by`).

- blocks translations as we dont have them (see #28831)
- blocks possibility of switching to Intl zones which doesnt really have this filter feature (see #28836)

~While at it, i solved a few issues with `OptionsResolver` that is able to deprecate options as of 4.2 also.~ Fixed in #28878

- when resolved trigger the deprecation
- allow to opt-out from triggering the deprecation
- dont trigger deprecation for default values (only given ones)

Commits
-------

5cb532d [Form] Deprecate TimezoneType regions option
CHANGELOG
=========
4.2.0

This comment has been minimized.

@nicolas-grekas
@chalasr

👍 Once PR rebased and remaining comment addressed

@ro0NL

This comment has been minimized.

Contributor

ro0NL commented Dec 13, 2018

ill rebase and compile the full list tomorrow. Meanwhile, can we decide on #28846 Not sure we want to add the boilerplate classes now, only to deprecate them later again.

}
if (null === $city && 0 !== strrpos($zone, 'Etc:') && false !== $i = strrpos($zone, ':')) {
$city = str_replace('_', ' ', substr($zone, $i + 1));

This comment has been minimized.

@ro0NL

ro0NL Dec 13, 2018

Contributor

i need to check if this fallback is still needed. Ive added the root bundle fallback above later, and AFAIK it makes this one redundant.

status: needs work

if (null === $name && isset($metazones[$zone]) && isset($localeBundle['zoneStrings']['meta:'.$metazones[$zone]])) {
$metadata = $localeBundle['zoneStrings']['meta:'.$metazones[$zone]];
$name = $metadata->get('ls') ?? $metadata->get('lg') ?? $metadata->get('ld') ?? $name;

This comment has been minimized.

@ro0NL

ro0NL Dec 13, 2018

Contributor

same; double check if this can be obtained from the root bundle as well.

}
}
if (null === $name || '' === $name) {

This comment has been minimized.

@ro0NL

ro0NL Dec 13, 2018

Contributor

double check where the empty string comes from. Also if name is null it should use the zone ID instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment