Skip to content

Repository files navigation

TextareaLocalizer

Transform your simple textarea into a localizable one.

Install

npm i @andreazorzi/textarealocalizer

Usage

app.js

// TextareaLocalizerimportTextareaLocalizerfrom"@andreazorzi/textarealocalizer";window.TextareaLocalizer=TextareaLocalizer;

app.css

@import"@andreazorzi/textarealocalizer/textarea-localizer.css";

HTML

<textareaid="textarea"></textarea><script>letoptions={"it": "Ciao","en": "Hello","de": "Hallo",}lettextarea=newTextareaLocalizer("#textarea",options)</script>

Options List

{
default_language: null, // Set the language to show by default
texts: { // Set the texts, the keys are the available languages
"it": "", "en": "", "de": "",
"fr": "",
"ru": "",
"at": "",
"ch": "",
"es": "",
"ie": "",
},
languages_icons: {
"it": "path/to/asset.png"
},
custom_classes: { // Set the custom classes for each elements
textarea: "",
}
}

Methods

// Get all plugin languagesgetAllLanguages()// Get available languagesgetLanguages()// Switch languagechangeLanguage(lang)// Get all languages valuesgetValues()// Get the value of a single languagegetValue(lang)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages