Skip to content

Commit

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

#### getDefaultLocaleByCountry

The getDefaultLocaleByCountry API simplifies the process of retrieving the default locale for any country. With a quick query, it provides the primary locale used in the specified country, ensuring seamless localization for applications.

##### Examples

```javascript
// Getting default locale of a country
const res = await getDefaultLocaleByCountry('AF');
console.log(res);
/*
fa_AF
*/

// Passing invalid country code
getDefaultLocaleByCountry('XYZ').catch((err) => {
console.log(err);
}); // Outputs Invalid country code: XYZ
```

#### 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 334c278

Please sign in to comment.