Skip to content
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

A more advanced version with Translation support? #38

Open
andrewfenn opened this issue Mar 30, 2017 · 2 comments
Open

A more advanced version with Translation support? #38

andrewfenn opened this issue Mar 30, 2017 · 2 comments

Comments

@andrewfenn
Copy link

This is a big feature request, however it would be nice to be able to have some extra classes I could plug in to swap the country name into different languages.

Here is some mockup code to demonstrate how you might use such an implementation..

use \League\ISO3166\ISO3166;
use \League\ISO3166\Translate;

$translate = new Translate;
$iso3166   = new ISO3166;
/* example data (original in english)
    ['name' => 'China',
    'alpha2' => 'CN',
    'alpha3' => 'CHN',
    'numeric' => '156',
    'currency' => 'CNY',]
*/

$iso3166_zh_hans = $translate->use('zh-Hans', $iso3166);
/* example data (Chinese Simplified)
    ['name' => '中国',
    'alpha2' => 'CN',
    'alpha3' => 'CHN',
    'numeric' => '156',
    'currency' => 'CNY',]
*/

$iso3166_zh_hant = $translate->use('zh-Hant', $iso3166);
/* example data (Chinese Traditional)
    ['name' => '中國',
    'alpha2' => 'CN',
    'alpha3' => 'CHN',
    'numeric' => '156',
    'currency' => 'CNY',]
*/
@alcohol
Copy link
Member

alcohol commented Mar 31, 2017

I have looked into this in the past, but honestly the scope of that is far beyond the purpose of this simple library. It would probably best be implemented in a library that extends this one.

@tPl0ch
Copy link

tPl0ch commented Oct 16, 2017

@andrewfenn you can use any ICU implementation (i.e. Symfony Intl) to get top-level country name translations from alpha-2 codes.

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

No branches or pull requests

3 participants