inst-tinymce-locales

0.7.0 • Public • Published

inst-tinymce-locales

npm

Exposes a fetchTranslations function that takes a language code (required) and custom language code mappings (optional), and returns an object with translations (if translations for that language are supported) or undefined (if translations for that language are not supported). Returned translation objects will have two keys: languageCode and content. languageCode refers to the TinyMCE language code for the translations, and content contains all translations.

const { fetchTranslations } = require('inst-tinymce-locales')
fetchTranslations('ru') // returns a translations object
fetchTranslations('myCustomLanguage') // returns undefined
fetchTranslations('myCustomLanguage', { myCustomLanguage: 'ru' }) // returns a translations object

Once translations are fetched, one will typically want to load them in their tinymce instance:

translations = fetchTranslations('de')
tinymce.addI18n(translations.languageCode, translations.content)

Package Sidebar

Install

npm i inst-tinymce-locales

Weekly Downloads

0

Version

0.7.0

License

MIT

Unpacked Size

276 kB

Total Files

21

Last publish

Collaborators

  • spencerolson