Socket
Socket
Sign inDemoInstall

@lion/localize

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lion/localize

The localization system helps to manage localization data split into locales and automate its loading


Version published
Maintainers
1
Created
Source

Localize

The localization system helps to manage localization data split into locales and automate its loading.

Live Demo/Documentation

See our storybook for a live demo and documentation

How to use

Installation

npm i --save @lion/localize
import { localize } from '@lion/localize';

Example

Translation data:

// path/to/hello-world/translations/en-GB.js
export default { greeting: 'Hello {name}!', };`

Loading translations:

// path/to/hello-world/HelloWorld.js
localize.loadNamespace({
  'hello-world': locale => {
    return import(`./translations/${locale}.js`);
  },
});

Note: dynamic variables inside dynamic imports may cause problems with tools that do static analysis, and may not work out of the box

Translating messages:

localize.msg('hello-world:greeting', { name: 'John' });
// Hello John!

Keywords

FAQs

Package last updated on 29 Apr 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc