npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-i18n-iso-countries

v1.5.0

Published

Ember i18n for ISO 3166-1 country codes, support Alpha-2, Alpha-3 and Numeric codes

Downloads

477

Readme

Ember-i18n-iso-countries

npm version Ember Observer Score

Ember.js Addon Wrapper for the i18n-iso-countries.

i18n for ISO 3166-1 country codes. We support Alpha-2, Alpha-3 and Numeric codes from http://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements

Installation

  • ember install ember-i18n-iso-countries

Code to Country

Get the name of a country by it's ISO 3166-1 Alpha-2, Alpha-3 or Numeric code

import { getName } from 'ember-i18n-iso-countries';
console.log("US (Alpha-2) => " + getName("US", "en")); // United States
console.log("US (Alpha-2) => " + getName("US", "de")); // Vereinigte Staaten von Amerika
console.log("USA (Alpha-3) => " + getName("USA", "en")); // United States
console.log("USA (Numeric) => " + getName("840", "en")); // United States

Get all names by their ISO 3166-1 Alpha-2 code

import { getNames } from 'ember-i18n-iso-countries';
console.log(getNames("en")); // { 'AF': 'Afghanistan', 'AL': 'Albania', [...], 'ZM': 'Zambia', 'ZW': 'Zimbabwe' }

Supported languages

  • en: english
  • de: german
  • nl: dutch
  • fr: french
  • sv: swedish
  • es: spanish
  • pt: portuguese
  • fi: finnish
  • ru: russian
  • ar: arabic
  • zh: chinese

Country to Code

import { getAlpha2Code } from 'ember-i18n-iso-countries';
console.log("United States => " + getAlpha2Code('United States', 'en')); // US

Codes

Convert Alpha-3 to Alpha-2 code

import { alpha3ToAlpha2 } from 'ember-i18n-iso-countries';
console.log("USA (Alpha-3) => " + alpha3ToAlpha2("USA") + " (Alpha-2)"); // United States

Convert Numeric to Alpha-2 code

import { numericToAlpha2 } from 'ember-i18n-iso-countries';
console.log("840 (Numeric) => " + numericToAlpha2("840") + " (Alpha-2)"); // United States

Convert Alpha-2 to Alpha-3 coe

import { alpha2ToAlpha3 } from 'ember-i18n-iso-countries';
console.log("DE (Alpha-2) => " + alpha2ToAlpha3("DE") + " (Alpha-3)"); // Germany

Convert Numeric to Alpha-3 code

import { numericToAlpha3 } from 'ember-i18n-iso-countries';
console.log("840 (Numeric) => " + numericToAlpha3("840") + " (Alpha-3)"); // United States

Convert Alpha-3 to Numeric code

import { alpha3ToNumeric } from 'ember-i18n-iso-countries';
console.log(alpha3ToNumeric("SWE")); // 752

Convert Alpha-2 to Numeric code

import { alpha2ToNumeric } from 'ember-i18n-iso-countries';
console.log(alpha2ToNumeric("SE")); // 752

Get all Alpha-2 codes

import { getAlpha2Codes } from 'ember-i18n-iso-countries';
console.log(getAlpha2Codes()); // { 'AF': 'AFG', 'AX': 'ALA', [...], 'ZM': 'ZMB', 'ZW': 'ZWE' }

Get all Alpha-3 codes

import { getAlpha3Codes } from 'ember-i18n-iso-countries';
console.log(getAlpha3Codes()); // { 'AFG': 'AF', 'ALA': 'AX', [...], 'ZMB': 'ZM', 'ZWE': 'ZW' }

Get all Numeric codes

import { getNumericCodes } from 'ember-i18n-iso-countries';
console.log(getNumericCodes()); // { '4': 'AF', '8': 'AL', [...], '887': 'YE', '894': 'ZM' }

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

##Contributing

PRs welcome!