Guest User

Untitled

a guest
Oct 24th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. Countries where the most spoken language is English according to CLDR territoryInfo.json.
  2.  
  3. ```
  4. {
  5. "AC": "99%",
  6. "AG": "86%",
  7. "AI": "95%",
  8. "AU": "96%",
  9. "BB": "100%",
  10. "BE": "59%",
  11. "BM": "92%",
  12. "BS": "100%",
  13. "BW": "81%",
  14. "BZ": "100%",
  15. "CA": "86%",
  16. "CK": "95%",
  17. "CX": "63%",
  18. "DG": "99%",
  19. "DM": "94%",
  20. "ET": "43%",
  21. "FJ": "94%",
  22. "FK": "96%",
  23. "FM": "57%",
  24. "GB": "99%",
  25. "GD": "96%",
  26. "GG": "100%",
  27. "GI": "80%",
  28. "GM": "40%",
  29. "GU": "91%",
  30. "GY": "100%",
  31. "IE": "98%",
  32. "IM": "100%",
  33. "IO": "100%",
  34. "JE": "95%",
  35. "JM": "98%",
  36. "KI": "100%",
  37. "KN": "98%",
  38. "KY": "98%",
  39. "LC": "90%",
  40. "LR": "83%",
  41. "MH": "93%",
  42. "MP": "97%",
  43. "MS": "66%",
  44. "MW": "63%",
  45. "NF": "76%",
  46. "NG": "53%",
  47. "NR": "98%",
  48. "NU": "95%",
  49. "NZ": "98%",
  50. "PH": "64%",
  51. "PN": "85%",
  52. "SB": "100%",
  53. "SG": "93%",
  54. "SH": "69%",
  55. "SX": "68%",
  56. "SZ": "80%",
  57. "TA": "99%",
  58. "TC": "98%",
  59. "TK": "100%",
  60. "TT": "88%",
  61. "UM": "100%",
  62. "US": "96%",
  63. "VC": "96%",
  64. "VG": "98%",
  65. "VI": "75%",
  66. "ZA": "31%"
  67. }
  68. ```
  69.  
  70. Script used:
  71. ```js
  72. let territoryInfo = require('./territoryInfo.json')
  73.  
  74. let ret = Object.assign(...Object.entries(territoryInfo.supplemental.territoryInfo)
  75. .map(([country, data])=> (
  76. [
  77. country,
  78. Object.entries(data.languagePopulation || {})
  79. .map(([language, data]) => (
  80. [language, +data._populationPercent]
  81. ))
  82. .sort((a, b) => b[1] - a[1])
  83. [0]
  84. ]
  85. ))
  86. .filter(([country, data]) => data)
  87. .filter(([country, [language, percent]]) => language === "en")
  88. .map(([country, [language, percent]]) => ({[country]: `${percent}%`})))
  89.  
  90.  
  91. console.log(JSON.stringify(ret, null, 2));
  92. ```
Add Comment
Please, Sign In to add comment