Skip to content

Commit

Permalink
[docs]: add docs for getByCountry api
Browse files Browse the repository at this point in the history
  • Loading branch information
RgnDunes committed Dec 19, 2024
1 parent c18fd9d commit 06b611e
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions packages/i18nify-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,55 @@ console.log(res);
*/
```

#### getByCountry

The getByCountry API offers a treasure trove of information about any country in the world. With a single query, you can uncover details like country names, languages, currencies, dial codes, timezones, and even links to their flags. It’s a perfect tool for building apps that need geographic or cultural context.

##### Examples

```javascript
// Fetching the list of metadata for a country
const res = await getByCountry('AF');
console.log(res);
/*
{
"country_name": "Afghanistan",
"continent_code": "AS",
"continent_name": "Asia",
"alpha_3": "AFG",
"numeric_code": "004",
"flag": "https://flagcdn.com/af.svg",
"sovereignty": "UN member state",
"dial_code": "+93",
"supported_currency": [
"AFN"
],
"timezones": {
"Asia/Kabul": {
"utc_offset": "UTC +04:30"
}
},
"timezone_of_capital": "Asia/Kabul",
"locales": {
"fa_AF": {
"name": "Persian (Afghanistan)"
},
"ps": {
"name": "Pashto"
},
"uz_AF": {
"name": "Uzbek"
},
"tk": {
"name": "Turkmen"
}
},
"default_locale": "fa_AF",
"default_currency": "AFN"
}
*/
```

#### getStates(country_code)

Embark on a state-by-state discovery with the getStates API! Get access to a treasure trove of state information, including names, time zones, and even a list of vibrant cities within each state.
Expand Down

0 comments on commit 06b611e

Please sign in to comment.