Skip to content

Commit

Permalink
feat: added the getLocale() API
Browse files Browse the repository at this point in the history
  • Loading branch information
kurone-kito committed May 6, 2021
1 parent d31686a commit ff57cd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/dantalion-i18n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ The instance provides a set of functions that retrieve human-readable resources
- Type: `ResourcesAccessor<DetailsType, Communication>`
- The [`Communication`](../dantalion-core#communication) type is a string literal union type provided by the `@kurone-kito/dantalion-core` library.

### `getLocale(): string | undefined`

It provides the appropriate locale information acquisition function according to the current environment.

For Node.js version 12.1.0 and later or web browsers, it depends on the [Intl API](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl)'s decision. If not, it determines by the environment variables.

- Arguments: _(None)_
- Returns: The locale string e.g. `en-US.utf8` or undefined value.

### `genius`

The instance provides a set of functions that retrieve human-readable resources related to natural personality.
Expand Down
1 change: 1 addition & 0 deletions packages/dantalion-i18n/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type {
import getResourcesAccessor, { ResourcesAccessor } from './resources';
import getResourcesAsync from './resources/t';

export { default as getLocale } from './getLocale';
export type {
DetailsBaseType,
DetailsType,
Expand Down

0 comments on commit ff57cd1

Please sign in to comment.