patch United States to United States of America

This commit is contained in:
Wille Marcel 2020-07-24 08:46:47 -03:00
parent cdfaae335a
commit 2d4cdc0a86
7 changed files with 14 additions and 7 deletions

View file

@ -1,8 +1,8 @@
version: 2 version: 2
updates: updates:
# Enable version updates for npm # Enable version updates for npm
- package-ecosystem: "npm" - package-ecosystem: 'npm'
# Look for `package.json` and `lock` files in the `root` directory # Look for `package.json` and `lock` files in the `root` directory
directory: "/" directory: '/'
schedule: schedule:
interval: "weekly" interval: 'weekly'

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{ {
"name": "@hotosm/iso-countries-languages", "name": "@hotosm/iso-countries-languages",
"version": "1.0.0", "version": "1.0.1",
"description": "ISO 639-1 languages and ISO 3166-1 countries translated in the languages required by Tasking Manager", "description": "ISO 639-1 languages and ISO 3166-1 countries translated in the languages required by Tasking Manager",
"main": "./lib/iso-countries-languages.js", "main": "./lib/iso-countries-languages.js",
"scripts": { "scripts": {

View file

@ -203,7 +203,7 @@
"UA": "Ukraine", "UA": "Ukraine",
"AE": "United Arab Emirates", "AE": "United Arab Emirates",
"GB": "United Kingdom", "GB": "United Kingdom",
"US": "United States", "US": "United States of America",
"UY": "Uruguay", "UY": "Uruguay",
"UZ": "Uzbekistan", "UZ": "Uzbekistan",
"VU": "Vanuatu", "VU": "Vanuatu",

3
scripts/patches.json Normal file
View file

@ -0,0 +1,3 @@
{
"en": [{ "key": "US", "value": "United States of America" }]
}

View file

@ -2,6 +2,7 @@ import fs from 'fs';
import supportedLangs from '../src/supportedLangs'; import supportedLangs from '../src/supportedLangs';
import countriesGeojson from '../res/countries'; import countriesGeojson from '../res/countries';
import patches from './patches';
import { getCountryName, getCountryCode } from './utils'; import { getCountryName, getCountryCode } from './utils';
const countries = countriesGeojson.elements const countries = countriesGeojson.elements
@ -11,6 +12,9 @@ const countries = countriesGeojson.elements
for (const lang of supportedLangs) { for (const lang of supportedLangs) {
const data = {}; const data = {};
countries.forEach((country) => (data[getCountryCode(country)] = getCountryName(country, lang))); countries.forEach((country) => (data[getCountryCode(country)] = getCountryName(country, lang)));
if (patches[lang]) {
patches[lang].forEach((entry) => (data[entry.key] = entry.value));
}
fs.writeFileSync(`./res/countries/${lang}.json`, JSON.stringify(data)); fs.writeFileSync(`./res/countries/${lang}.json`, JSON.stringify(data));
} }
console.log('Finished!'); console.log('Finished!');

File diff suppressed because one or more lines are too long