Lisan

Lisan

  • Docs
  • API
  • Try it out
  • Examples
  • GitHub

›About

About

  • Lisan
  • How it works?
  • Performance
  • Lisan Compiler
  • Lisan CLI
  • Lisan Locales
  • Plugins
  • Adapters

Components

  • Translations
  • Dictionary
  • Conditional Groups
  • Formatters

Plugins

  • Localization
  • Loader

Guides & Tips

  • Pluralization
  • JSX Interpolation
  • Multiple Instances
  • Write Plugins

API

  • Lisan
  • Lisan Compiler
  • Lisan CLI
Edit

What is Lisan?

Lisan (Turkish: lee · sun) is an i18n (internationalization) library.

It provides all essential tooling to have multiple languages in your applications and format numbers, currencies, ordinals & dates based on locale.

Lisan's biggest difference compared to traditional i18n libraries is taking advantage of ES6 Template Literals and using them to generate functions to interpolate strings.


What is Lisan trying to solve?

Most of the i18n libraries are based on some sort of template engine to interpolate strings and these template engines use regex or loops under the hood to find & replace the placeholders.

However, using regex lookups or javascript loops decreases the performance significantly (especially on client-side) since find & replace is being done on runtime.


How lisan solves it?

Lisan adds an extra step to CI, but a giant performance gain to app kind!

Lisan introduces a Dictionary concept where a dictionary entry can be either just a string or a javascript function that interpolates placeholders and returns a string. Since there is no need finding & replacing placeholder templates, we can avoid using regex or loops.

It is that simple.

Of course, maintaining javascript files to store translations could be challenging and not ideal. Especially when using third-party software like transifex or crowdin.

That's why Lisan also provides a compiler and a command line tool to generate Dictionary objects from Translation JSON files. Dictionary objects are saved in javascript files.

Enriched with plugins

Also, you can use existing plugins or write your plugins to extend the capabilities of Lisan.

  • lisan-plugin-l10n: adds localization formatters.
  • lisan-plugin-loader: adds loading methods to dynamically import javascript files.

Installation

You can install lisan from the sources below, as you see fit.

from npm

npm install lisan

from CDN

<script src="https://unpkg.com/lisan/dist/index.umd.js" type="text/javascript"></script>

After adding the script tag above, all public variables will be accessible via window.lisanJS variables.

Usage:

<script
  src="https://unpkg.com/lisan/dist/index.umd.js"
  type="text/javascript"
></script>
<script type="text/javascript">
  (() => {
    const { lisan, t, c, Lisan } = window.lisanJS;
  })();
</script>

Compatibility

PlatformIEEdgeFirefoxChromeNodejs
Version8+AllAllAll8+
Last updated on 3/31/2020
How it works? →
  • What is Lisan trying to solve?
  • How lisan solves it?
    • Enriched with plugins
  • Installation
    • from npm
    • from CDN
  • Compatibility
Lisan
Docs
AboutComponentsPluginsGuide & TipsAPI Reference
Ecosystem
LisanLisan LocalesLisan CompilerLisan CLILocalization PluginLoader PluginLisan Types
More
IssuesGitHubSupport Us