Translation

One of the complexities of natural language is that there are so many of them. Lacona was originally developed to use English, but it is designed to support all languages.

Ultimately, Lacona commands process strings. They make no assumptions about character sets, grammar, word separators, or word order. If a sentence can be expressed in Unicode, Lacona can be taught to understand it.

A Basic Example

To have a translatable phrase, simply give your phrase a translations property, which is an array of objects. Each object should have a lang or langs property, which contains IETF RFC 5646 language tags, and a describe function, which works exactly the same as the default describe function. The most specific available translation will be selected and used for this phrase.

const MyPhrase = {
  translations: [{
    langs: ['en'],
    describe: () => <literal text='truck' />
  }, {
    langs: ['en-GB', 'en-ZA', 'en-IE', 'en-IN'],
    describe: () => <literal text='lorry' />
  }, {
    lang: 'es',
    describe: () => <literal text='camión' />
  }],
  // a default describe should be provided in case none of the languages match
  //  usually American English
  describe: () => <literal text='truck' />
}