How to use the i18n-iso-countries.registerLocale function in i18n-iso-countries

To help you get started, we’ve selected a few i18n-iso-countries examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github honeytrap / honeytrap / vendor / github.com / honeytrap / honeytrap-web / src / index.js View on Github external
import promise from 'redux-promise';
// import css from './style.css';
import css from './toolkit-inverse.css';
import application_css from './application.css';
import routes from './routes';

import { Websocket } from './components/index';

import App from './components/app';

import reducers from './reducers';

import { syncHistoryWithStore, ConnectedRouter, routerReducer, routerMiddleware, push } from 'react-router-redux'

import * as countries from 'i18n-iso-countries';
countries.registerLocale(require("i18n-iso-countries/langs/en.json"));

const history = createHistory();

function configureStore() {
    return createStore(
        reducers,
        {},
        applyMiddleware(
            routerMiddleware(history),
            promise,
        ),
    );
}

const store = configureStore({
    sessions: { all: [], events: [], session: null, content: [], metadata: null, hotCountries: [], connected: false, topology: {} },
github ezpaarse-project / ezpaarse / client / plugins / i18n.js View on Github external
import Vue from 'vue';
import VueI18n from 'vue-i18n';
import moment from 'moment';
import i18nIsoCode from 'i18n-iso-countries';

import en from '~/locales/en.json';
import fr from '~/locales/fr.json';

i18nIsoCode.registerLocale(require('i18n-iso-countries/langs/en.json'));
i18nIsoCode.registerLocale(require('i18n-iso-countries/langs/fr.json'));

Vue.use(VueI18n);
moment.locale('fr');

export default ({ app }) => {
  // Set i18n instance on app
  // This way we can use it in middleware and pages asyncData/fetch
  app.i18n = new VueI18n({
    locale: 'fr',
    fallbackLocale: 'fr',
    messages: {
      en,
      fr
    }
  });
github danielgrijalva / overworld / frontend / src / modules / game / components / details / index.js View on Github external
import React from "react";
import PropTypes from "prop-types";
import { Tab, Grid, Label } from "semantic-ui-react";
import countries from "i18n-iso-countries";
import Moment from "react-moment";
import "./styles.css";

countries.registerLocale(require("i18n-iso-countries/langs/en.json"));

const Details = ({ game }) => {
  const gameCountries = game.involved_companies
    ? [
        ...new Set(
          game.involved_companies
            .filter(companyInfo => companyInfo.company.country !== undefined)
            .map(companyInfo =>
              countries.getName(companyInfo.company.country, "en")
            )
        )
      ]
    : [];

  return (
github danielgrijalva / overworld / frontend / src / modules / game / components / details / index.js View on Github external
import React from "react";
import PropTypes from "prop-types";
import { Tab, Grid, Label } from "semantic-ui-react";
import countries from "i18n-iso-countries";
import Moment from "react-moment";
import "./styles.css";

countries.registerLocale(require("i18n-iso-countries/langs/en.json"));

const Details = ({ game }) => {
  const gameCountries = game.involved_companies
    ? [
        ...new Set(
          game.involved_companies
            .filter(companyInfo => companyInfo.company.country !== undefined)
            .map(companyInfo =>
              countries.getName(companyInfo.company.country, "en")
            )
        )
      ]
    : [];

  return (
github topcoder-platform / community-app / src / shared / utils / countries.js View on Github external
/**
 * Provides lookup data for countryies.
 */
import _ from 'lodash';

import countryUtil from 'i18n-iso-countries';
import enCountries from 'i18n-iso-countries/langs/en.json';

countryUtil.registerLocale(enCountries);

const countries = [];

_.forIn(countryUtil.getNames('en'), (name, alpha2) => {
  countries.push({ name, alpha3: countryUtil.alpha2ToAlpha3(alpha2) });
});

export function getCountryObjFromAlpha3(alpha3) {
  if (!alpha3) {
    return null;
  }
  const name = countryUtil.getName(alpha3, 'en');
  if (!name) {
    return null;
  }
  return { name, alpha3 };
github philsturgeon / awesome-earth / src / countries.js View on Github external
import countries from 'i18n-iso-countries';
import flag from 'country-code-emoji';

countries.registerLocale(require('i18n-iso-countries/langs/en.json'));

const Countries = {
  fromAlpha2Code: code => {
    return {
      name: countries.getName(code, 'en'),
      emoji: flag(code),
    };
  },
};

export default Countries;
github simonepri / country-iso / demo.js View on Github external
const leaflet = require('leaflet');
const ci18n = require('i18n-iso-countries');
const GeoJsonGeometriesLookup = require('geojson-geometries-lookup');

ci18n.registerLocale(require('i18n-iso-countries/langs/en.json'));

async function fetchMapAsync() {
  const response = await fetch('https://unpkg.com/@geo-maps/countries-maritime-10m/map.geo.json');
  const data = await response.json();
  return data;
}

let worldLookup = null;
async function getCodes(lat, lng) {
  if (worldLookup === null) {
    const map = await fetchMapAsync();
    worldLookup = new GeoJsonGeometriesLookup(map);
  }

  const countries = worldLookup.getContainers({type: 'Point', coordinates: [lng, lat]});
github BigDataBoutique / ElastiQuill / admin-frontend / src / pages / Dashboard.js View on Github external
import _ from "lodash";
import React, { Fragment } from "react";
import moment from "moment";
import countries from "i18n-iso-countries";
import { inject, observer } from "mobx-react";

countries.registerLocale(require("i18n-iso-countries/langs/en.json"));

import VisitsMap from "../components/VisitsMap";
import CommentsList from "../components/CommentsList";
import LoggedInLayout from "../components/LoggedInLayout";
import StatsOverTimeGraph from "../components/StatsOverTimeGraph";

@inject("dashboardStore")
@observer
class Dashboard extends React.Component {
  componentDidMount() {
    this.props.dashboardStore.loadStats();
  }

  render() {
    return (