Skip to content

Add documentation about alpha3 methods #12105

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

Merged
merged 1 commit into from
Aug 15, 2019
Merged

Add documentation about alpha3 methods #12105

merged 1 commit into from
Aug 15, 2019

Conversation

terjebraten-certua
Copy link
Contributor

@terjebraten-certua terjebraten-certua commented Aug 6, 2019

Replaces #12104

@OskarStark OskarStark added Intl Waiting Code Merge Docs for features pending to be merged labels Aug 7, 2019
symfony-splitter pushed a commit to symfony/intl that referenced this pull request Aug 9, 2019
…braten-certua)

This PR was merged into the 4.4 branch.

Discussion
----------

[Intl] Support ISO 3166-1 Alpha-3 country codes

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20313
| Doc PR | symfony/symfony-docs#12105
| License       | MIT

This is a pre-requiste for fixing #20313 and only handles the changes to the INTL component.

Commits
-------

848f60e905 Support ISO 3166-1 Alpha-3 country codes
fabpot added a commit to symfony/symfony that referenced this pull request Aug 9, 2019
…braten-certua)

This PR was merged into the 4.4 branch.

Discussion
----------

[Intl] Support ISO 3166-1 Alpha-3 country codes

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20313
| Doc PR | symfony/symfony-docs#12105
| License       | MIT

This is a pre-requiste for fixing #20313 and only handles the changes to the INTL component.

Commits
-------

848f60e Support ISO 3166-1 Alpha-3 country codes
@OskarStark OskarStark removed the Waiting Code Merge Docs for features pending to be merged label Aug 14, 2019
@OskarStark
Copy link
Contributor

@ro0NL would you do me a favor and review this PR? Thank you 😃

@OskarStark OskarStark added this to the 4.4 milestone Aug 14, 2019
Copy link
Contributor

@ro0NL ro0NL left a comment

Choose a reason for hiding this comment

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

😁

@@ -79,6 +79,20 @@ The ``Languages`` class provides access to the name of all languages::
$language = Languages::getName('fr');
// => 'French'

If you want to you can also use the ISO 639-2 three-letter language codes instead of
the ISO 639-1 two-letter codes. (They are here called alpha3 codes.)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can also use the ISO 639-2 three-letter language codes instead of
the ISO 639-1 two-letter codes, respectively called alpha3 and alpha2 codes. 


use Symfony\Component\Intl\Countries;

\Locale::setDefault('en');

// Indexed with alpha-2
$countries = Countries::getNames();
// ('countryCode' => 'countryName')
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps mention "alpha2" here to reduce comments, e.g. // ('alpha2Code' => 'countryName')

$countries = Countries::getNames();
// ('countryCode' => 'countryName')
// => ['AF' => 'Afghanistan', 'AX' => 'Åland Islands', ...]

// Indexed with alhpa-3
$countries = Countries::getAlpha3Names();
// ('countryCode' => 'countryName')
Copy link
Contributor

Choose a reason for hiding this comment

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

same // ('alpha3Code' => 'countryName')

$country = Countries::getName('GB', 'de');
// => 'Vereinigtes Königreich'

$country = Countries::getName('GBR', 'de');
Copy link
Contributor

Choose a reason for hiding this comment

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

getAlpha3Name

$isValidCountry = Countries::exists($countryCode);
$isValidCountry = Countries::exists($alpha2Code);

$isValidCountry = Countries::alpha3CodeExists($alpha2Code);
Copy link
Contributor

Choose a reason for hiding this comment

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

i would add a paragraph in between like languages does

Or if you have a alpha3 country code you want to check:

    $isValidCountry = Countries::alpha3CodeExists($alpha3Code);

@@ -94,6 +108,16 @@ to catching the exception, you can also check if a given language code is valid:

$isValidLanguage = Languages::exists($languageCode);

Or if you have a three-letter language code you want to check:
Copy link
Contributor

Choose a reason for hiding this comment

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

:: i believe (not a format expert here :D)

@OskarStark
Copy link
Contributor

OskarStark commented Aug 15, 2019

It took time, but here we go, this is in now. Thank you very much Terje.

I made the requested changes while merging (b3d776d) 👍

@OskarStark OskarStark merged commit 5044b35 into symfony:4.4 Aug 15, 2019
OskarStark added a commit that referenced this pull request Aug 15, 2019
…rtua)

This PR was merged into the 4.4 branch.

Discussion
----------

Add documentation about alpha3 methods

Replaces #12104

Commits
-------

5044b35 Add documentation about alpha3 methods
OskarStark added a commit that referenced this pull request Aug 15, 2019
OskarStark added a commit that referenced this pull request Aug 15, 2019
* 4.4:
  Tweaks. refs #12105
  Add documentation about alpha3 methods
@ro0NL ro0NL mentioned this pull request Aug 15, 2019
OskarStark added a commit that referenced this pull request Aug 15, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

Update intl.rst

tiny follow up of #12105

cc @OskarStark

Commits
-------

d757a2d Update intl.rst
OskarStark added a commit that referenced this pull request Aug 15, 2019
This PR was squashed before being merged into the 4.3 branch (closes #12173).

Discussion
----------

Mention ISO 639 for languages

we've added this in 4.4 (#12105), but languages in 4.3 already had (partial) alpha3 support.

let me know if this is merged in 4.4 :) it needs some cleanup after.

cc @OskarStark

Commits
-------

8ee8df7 Mention ISO 639 for languages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants