@just-web/browser-i18n
TypeScript icon, indicating that this package has built-in type declarations

3.0.14 • Public • Published

@just-web/browser-i18n

NPM version NPM downloads

@just-web/browser-i18n provides basic i18n support for browser.

The setting is persisted in local storage.

Install

# npm
npm install @just-web/i18n

# yarn
yarn add @just-web/i18n

# pnpm
pnpm install @just-web/i18n

#rush
rush add -p @just-web/i18n

Usage

import { justApp } from '@just-web/app'
import { i18nGizmoFn } from '@just-web/i18n'

const app = await justApp({ name: 'your-app' })
  .with(i18nGizmoFn(navigator))
  .create()

app.i18n.getLanguage() // 'en'

Commands

It provides a setLanguageCommand, which allows you to set language using command.

import { justApp } from '@just-web/app'
import { commandsGizmoFn } from '@just-web/commands' // optional
import { keyboardGizmoFn } from '@just-web/keyboard' // optional
import { i18nGizmoFn } from '@just-web/i18n'

const app = await justApp({ name: 'your-app' })
  .with(commandsGizmoFn())
  .with(keyboardGizmoFn())
  .with(i18nGizmoFn(navigator))
  .create()

setLanguageCommand('fr')

Readme

Keywords

Package Sidebar

Install

npm i @just-web/browser-i18n

Weekly Downloads

179

Version

3.0.14

License

MIT

Unpacked Size

18.4 kB

Total Files

32

Last publish

Collaborators

  • unional