lxn
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

lxn-js

lxn-go is an lxn client library for the Javascript programming language.

Translating Text

To translate text, a catalog has to be loaded:

function readCatalog(buf: BufferSource): Translator

This function reads a binary catalog from buf, which could either be an ArrayBuffer or an ArrayBufferView, and returns its translator function. Once a translator function of type

type Translator = (key: string, ctx: Context) => string;

is obtained, it can be used to convert a key and a context into a message. The key specifies the message key within the catalog preceded by its section, i.e. section.message-key (or simply message-key if the message has no section). The context contains all the necessary variables to render this message correctly. For each variable in the catalog there has to be a value of the corresponding type.

Readme

Keywords

Package Sidebar

Install

npm i lxn

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

180 kB

Total Files

11

Last publish

Collaborators

  • tsne