Socket
Socket
Sign inDemoInstall

@kano/i18n

Package Overview
Dependencies
85
Maintainers
21
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @kano/i18n

Provide a simple message DB managment and localization function.


Version published
Weekly downloads
3
Maintainers
21
Install size
3.70 MB
Created
Weekly downloads
 

Readme

Source

Web i18n

Provide a simple message DB managment and localization function.

Usage

Add to your project using yarn add @kano/i18n;

Im port and use as follow

import { _, setDefaultLang, addSupportedLanguage } from '@kano/i18n/index.js';

// Add the supported langauges before using any other functions
addSupportedLanguage('de-DE');
// Set the default language, will be used if the browser is configured to use a non supported language
setDefaultLang('en-GB');

// Use the _ function to resolve all messages. Provide a fallback that will be used to generate
// the default language file
const message = _('UPDATE_NOW', 'Update now');

Generating the language files

Once all the strings in your codebase has been tokenized using the _ function, you can generate a language file using the provided tool.

Example:

i18n-generator ./code/**/*.js

Will print all keys and their default values from the codebase. Run i18n-generator --help to see all options

FAQs

Last updated on 17 Jun 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc