How to use i18n-iso-countries - 10 common examples

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 ovanta / vue-cloudfront-api / src / websocket.js View on Github external
if (!(userid in userMap)) {
                                userMap[userid] = {
                                    websockets: [],
                                    lastBroadcast: 0
                                };
                            } else if (userMap[userid].websockets.includes(ws)) {
                                return;
                            }

                            // Lookup ip info
                            const lu = geoip.lookup(req.connection.remoteAddress);

                            ws._sessionInfo = {
                                id: Math.floor(Math.random() * 1e15).toString(16) + Date.now().toString(16),
                                city: lu ? lu.city : 'Unknown',
                                country: lu ? i18nCountries.getName(lu.country, 'en') : 'Unknown',
                                device: userAgentParser(req.headers['user-agent'])
                            };

                            // Push to redis
                            redisClient.rpush(userid.toString(), JSON.stringify(ws._sessionInfo));

                            websocket.broadcast({
                                userid,
                                data: {
                                    type: 'open-session',
                                    value: ws._sessionInfo
                                }
                            });

                            // Append websocket
                            userMap[userid].websockets.push(ws);
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 cboard-org / cboard / src / i18n.js View on Github external
const splittedLang = lang.split(splitLangRgx);
  if (splittedLang.length < 1) {
    return lang;
  }
  let standardLang =
    splittedLang[0].length === 3
      ? alpha3TToAlpha2(splittedLang[0])
      : splittedLang[0];

  if (splittedLang.length === 1) {
    return standardLang;
  }

  let standardCountry =
    splittedLang[1].length === 3
      ? alpha3ToAlpha2(splittedLang[1])
      : splittedLang[1];

  return `${standardLang}-${standardCountry}`;
}
github danielgrijalva / overworld / frontend / src / modules / game / components / details / index.js View on Github external
.map(companyInfo =>
              countries.getName(companyInfo.company.country, "en")
            )
github HaliteChallenge / Halite-III / website / javascript / templates / LeagueIndividual.vue View on Github external
getCountryName: function (name) {
        var countries = require('i18n-iso-countries')
        return countries.getName(name, 'en')
      },
      copyToClipboard: function(){
github philsturgeon / awesome-earth / src / countries.js View on Github external
fromAlpha2Code: code => {
    return {
      name: countries.getName(code, 'en'),
      emoji: flag(code),
    };
  },
};
github danielgrijalva / overworld / frontend / src / modules / game / components / details / index.js View on Github external
.map(companyInfo =>
              countries.getName(companyInfo.company.country, "en")
            )
github SwitchbladeBot / switchblade / src / commands / games / steamladder / steamladder.js View on Github external
generateLadderEmbedTitle ({ type, country_code: cc }, t, language) {
    const title = t(`commands:steamladder.ladders.${type}`)
    if (cc) {
      const suffix = ` - ${title}`
      if (this.client.i18next.exists(`commands:steamladder.regions.${cc}`)) {
        return t(`commands:steamladder.regions.${cc}`) + suffix
      } else if (countries.getName(cc, language.substring(0, 2))) {
        return countries.getName(cc, language.substring(0, 2)) + suffix
      } else {
        return cc + suffix
      }
    }
    return title
  }
github massyao / china-invalid-vaccine-flow / js / model / map-model.js View on Github external
case 'SYR':
            return 'Syria';
        case 'MKD':
            return 'Macedonia';
        case 'IRN':
            return 'Iran';
        case 'LBY':
            return 'Libya';
        case 'RUS':
            return 'Russia';
        case 'RCB':
            return 'Congo';
        case 'COD':
            return 'Congo';
    }
    return countries.getName(country, 'en');
};