1.0.4 • Published 8 months ago

@andreazorzi/textarealocalizer v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

TextareaLocalizer

Transform your simple textarea into a localizable one.

Install

npm i @andreazorzi/textarealocalizer

Usage

app.js

// TextareaLocalizer
import TextareaLocalizer from "@andreazorzi/textarealocalizer";
window.TextareaLocalizer = TextareaLocalizer;

app.css

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

HTML

<textarea id="textarea"></textarea>

<script>
    let options = {
        "it": "Ciao", 
        "en": "Hello", 
        "de": "Hallo",
    }
    let textarea = new TextareaLocalizer("#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 languages
getAllLanguages()

// Get available languages
getLanguages()

// Switch language
changeLanguage(lang)

// Get all languages values
getValues()

// Get the value of a single language
getValue(lang)
1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago