Skip to content

A more advanced version with Translation support? #38

Open
@andrewfenn

Description

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',]
*/

Activity

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

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions