Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Countries where the most spoken language is English according to CLDR territoryInfo.json.
- ```
- {
- "AC": "99%",
- "AG": "86%",
- "AI": "95%",
- "AU": "96%",
- "BB": "100%",
- "BE": "59%",
- "BM": "92%",
- "BS": "100%",
- "BW": "81%",
- "BZ": "100%",
- "CA": "86%",
- "CK": "95%",
- "CX": "63%",
- "DG": "99%",
- "DM": "94%",
- "ET": "43%",
- "FJ": "94%",
- "FK": "96%",
- "FM": "57%",
- "GB": "99%",
- "GD": "96%",
- "GG": "100%",
- "GI": "80%",
- "GM": "40%",
- "GU": "91%",
- "GY": "100%",
- "IE": "98%",
- "IM": "100%",
- "IO": "100%",
- "JE": "95%",
- "JM": "98%",
- "KI": "100%",
- "KN": "98%",
- "KY": "98%",
- "LC": "90%",
- "LR": "83%",
- "MH": "93%",
- "MP": "97%",
- "MS": "66%",
- "MW": "63%",
- "NF": "76%",
- "NG": "53%",
- "NR": "98%",
- "NU": "95%",
- "NZ": "98%",
- "PH": "64%",
- "PN": "85%",
- "SB": "100%",
- "SG": "93%",
- "SH": "69%",
- "SX": "68%",
- "SZ": "80%",
- "TA": "99%",
- "TC": "98%",
- "TK": "100%",
- "TT": "88%",
- "UM": "100%",
- "US": "96%",
- "VC": "96%",
- "VG": "98%",
- "VI": "75%",
- "ZA": "31%"
- }
- ```
- Script used:
- ```js
- let territoryInfo = require('./territoryInfo.json')
- let ret = Object.assign(...Object.entries(territoryInfo.supplemental.territoryInfo)
- .map(([country, data])=> (
- [
- country,
- Object.entries(data.languagePopulation || {})
- .map(([language, data]) => (
- [language, +data._populationPercent]
- ))
- .sort((a, b) => b[1] - a[1])
- [0]
- ]
- ))
- .filter(([country, data]) => data)
- .filter(([country, [language, percent]]) => language === "en")
- .map(([country, [language, percent]]) => ({[country]: `${percent}%`})))
- console.log(JSON.stringify(ret, null, 2));
- ```
Add Comment
Please, Sign In to add comment