Skip to content

Instantly share code, notes, and snippets.

View alecrem's full-sized avatar
🏠
Working from home

Alejandro Cremades alecrem

🏠
Working from home
  • Kyushu University
  • Itoshima, Japan
  • X @karawapo
View GitHub Profile
@martinratinaud
martinratinaud / countries-translation.js
Created March 9, 2023 04:52
Get translated country names in javascript
const frRegionNames = new Intl.DisplayNames(["fr"], { type: 'region' });
frRegionNames.of("US") // 👉 'États-Unis'
const enRegionNames = new Intl.DisplayNames(["en"], { type: 'region' })
enRegionNames.of("US") // 👉 'United States'
const esRegionNames = new Intl.DisplayNames(["es"], { type: 'region' })
esRegionNames.of("US") // 👉 'Estados Unidos