Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Intl] Apply localeDisplayPattern and fix locale generation#31337

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 2 commits intosymfony:3.4fromro0NL:locale-format
May 7, 2019
Merged

[Intl] Apply localeDisplayPattern and fix locale generation#31337

fabpot merged 2 commits intosymfony:3.4fromro0NL:locale-format
May 7, 2019

Conversation

@ro0NL
Copy link
Contributor

@ro0NLro0NL commentedMay 1, 2019
edited
Loading

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no (few data changes)
Deprecations?no
Tests pass?yes (including intl-data group)
Fixed tickets#...
LicenseMIT
Doc PRsymfony/symfony-docs#...

Seehttps://github.com/unicode-org/icu/blob/e2d85306162d3a0691b070b4f0a73e4012433444/icu4c/source/data/lang/en.txt#L1281-L1285

Technically, this should be applied here:

This PR aims to implement it, but before it got to this point i noticed a false positive during generation (AFAIK). The current state solves this issue first.

While at it, i cleaned up dead-code inupdate-data.php to reduce the noise.

}

// Some languages are translated together with their region,
// i.e. "en_GB" is translated as "British English"
Copy link
ContributorAuthor

@ro0NLro0NLMay 1, 2019
edited
Loading

Choose a reason for hiding this comment

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

not applicable; we get the language name based onLocale::getPrimaryLanguage, which isen foren_GB already.

Thus we translate the expected language name already.


// Some languages are not translated
// Example: "az" (Azerbaijani) has no translation in "af" (Afrikaans)
if (null === ($name =$this->languageDataProvider->getName($lang,$displayLocale))) {
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

null API is not applicable, it throws instead. This is try/catched on the calling side already

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

besides, this case is translated in fact :D

// i.e. "en_GB" is translated as "British English"
// we don't include these languages though because they mess up
// the name sorting
// $name = $this->langBundle->getLanguageName($displayLocale, $lang, $region);
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

dead code ($this->langBundle)

}

// "as" (Assamese) has no "Variants" block
//if (!$langBundle->get('Variants')) {
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

dead code ($langBundle)

// For example, in German, zh_Hans is "Chinesisch (vereinfacht)".
// The latter is the script part which is already included in the
// extras and will be appended again with the other extras.
if (preg_match('/^(.+)\s+\([^\)]+\)$/',$name,$matches)) {
Copy link
ContributorAuthor

@ro0NLro0NLMay 1, 2019
edited
Loading

Choose a reason for hiding this comment

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

this causes the false positive, as someprimary language names matches

"nb":"нарвежская (букмол)",
"nb_NO":"нарвежская (Нарвегія)",
"nb_SJ":"нарвежская (Шпіцберген і Ян-Маен)",
"nb_NO":"нарвежская (букмол) (Нарвегія)",
Copy link
ContributorAuthor

@ro0NLro0NLMay 1, 2019
edited
Loading

Choose a reason for hiding this comment

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

if we look at theprimary language, e.g.nb we see it already includes(букмол) (this seems consistent across the changeset).

Other locales use different/no interpunction here, e.g.en

        "nb": "Norwegian Bokmål",        "nb_NO": "Norwegian Bokmål (Norway)",

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Google confirmsбукмол meansBokmål :)

"ks":"kashmiri",
"ks_IN":"kashmiri (Inde)",
"lu":"luba-katanga",
"lu_CD":"luba-katanga (Congo-Kinshasa)",
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

"zh_MO":"кытай (Макао Махсус Идарәле Төбәге)",
"zh_SG":"кытай (Сингапур)",
"zh_TW":"кытай (Тайвань)"
"zh_CN":"кытай (тәрҗемә киңәше: аерым алганда, мандарин кытайчасы) (Кытай)",
Copy link
ContributorAuthor

@ro0NLro0NLMay 1, 2019
edited
Loading

Choose a reason for hiding this comment

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

this looks scary, but seems the legit translation ofzh primary language :| (seehttps://github.com/unicode-org/icu/blob/master/icu4c/source/data/lang/tt.txt)

playing a bit with google translate i getChinese (Interpretation of Interpretation: Mandarin Chinese), but im not sure if anyone speakstt (Tatar?)

im still convinced the current regex wasnt anticipating it explicitly.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

as we already used this translation forzh directly (see above), im not sure we should care for now.

From here on we should rely on native speakers to add a possible "per case fix" IMHO.

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneMay 1, 2019
@ro0NL
Copy link
ContributorAuthor

to obtain thelocaleDisplayPattern we need to get it from the region domain, as such we need to temporary cross compile it from the locale generator.

To do so, i've refactored the LocaleDataGenerator to extend from AbstractDataGenerator, just like the other data generators. It's makes it a bit easier to follow IMHO, and a decent amount of logic was duplicated.

cc@webmozart

@ro0NLro0NL mentioned this pull requestMay 1, 2019
@ro0NL
Copy link
ContributorAuthor

Don't use the characters "(" and ")", since they will be confusing in combination with countries or scripts in more complex language names. If you have to use brackets, use square ones: [ and ].
(http://cldr.unicode.org/translation/language-names)

I think this is up to ICU to follow yes/no, they don't :)

As such we can replace the() in the primary language name with[] genericly. Im hesitant to remove it as a whole, as it clearly creates a difference with other locales (en, nl) who still include it, but use different/no interpunction. Then if a native speaker confirms the[...] is nonsense, we remove it per case.

@ro0NLro0NL changed the title[Intl] Apply localeDisplayPattern and fix locale generation[Intl] Fix locale name generationMay 1, 2019
@ro0NLro0NL marked this pull request as ready for reviewMay 1, 2019 13:26
@ro0NLro0NL changed the title[Intl] Fix locale name generation[Intl] Apply localeDisplayPattern and fix locale generationMay 1, 2019
@ro0NL
Copy link
ContributorAuthor

Ready for me 👍 , i'll send a follow up PR for master, to patch the timezone generator.

@ro0NL
Copy link
ContributorAuthor

This diff should be re-applied on 4.2:https://www.diffchecker.com/m77BMN8j Sorry if this is causing inconvenience :)

The important change here is we exposeBundleEntryReaderInterface to generators, this enables reading ICU data with fallback support, and helps us to get the correct display format or any other metadata needed.

I realized i've effectively rebuild this in master when adding timezones:

$accessor =staticfunction (array$indices, &$inherited =false)use ($localeBundles,$accessor) {

This should leverage the BundleEntryReaderInterface instead.

@fabpot
Copy link
Member

@ro0NL Can you create a PR?

@ro0NL
Copy link
ContributorAuthor

See#31402

@fabpot
Copy link
Member

Thank you@ro0NL.

@fabpotfabpot merged commita20a6cc intosymfony:3.4May 7, 2019
fabpot added a commit that referenced this pull requestMay 7, 2019
…ion (ro0NL)This PR was squashed before being merged into the 3.4 branch (closes#31337).Discussion----------[Intl] Apply localeDisplayPattern and fix locale generation| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no (few data changes)| Deprecations? | no| Tests pass?   | yes (including intl-data group)| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->Seehttps://github.com/unicode-org/icu/blob/e2d85306162d3a0691b070b4f0a73e4012433444/icu4c/source/data/lang/en.txt#L1281-L1285Technically, this should be applied here:https://github.com/symfony/symfony/blob/2b923a7c03e1ed1540c9dba224242defd9aa75cd/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php#L211This PR aims to implement it, but before it got to this point i noticed a false positive during generation (AFAIK). The current state solves this issue first.While at it, i cleaned up dead-code in `update-data.php` to reduce the noise.Commits-------a20a6cc recompile29e8aba [Intl] Apply localeDisplayPattern and fix locale generation
@ro0NLro0NL deleted the locale-format branchMay 7, 2019 10:00
fabpot added a commit that referenced this pull requestMay 7, 2019
…neration (ro0NL)This PR was squashed before being merged into the 4.2 branch (closes#31402).Discussion----------[Intl][4.2] Apply localeDisplayPattern and fix locale generation| Q             | A| ------------- | ---| Branch?       | 4.2| Bug fix?      | yes| New feature?  | no| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->Follow up of#31337 for 4.2Commits-------c902c8a recompilea3164de re-apply translator parents.json generation294ae7a [Intl] Apply localeDisplayPattern and fix locale generation
fabpot added a commit that referenced this pull requestMay 7, 2019
…neration (ro0NL)This PR was squashed before being merged into the 4.3-dev branch (closes#31403).Discussion----------[Intl][4.3] Apply localeDisplayPattern and fix locale generation| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->Follow up of#31337 &#31402  for 4.3 / masterCommits-------ed04f24 recompile504db27 re-apply api changes for TimezoneDataGeneratorc443e78 re-apply translator parents.json generationbf50b61 [Intl] Apply localeDisplayPattern and fix locale generation
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

4 participants

@ro0NL@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp