Expand your audience
npm install internationalisationProject status
--------------










Use case
--------
A jQuery plugin to replace alternate version of text for client side
internationalisation.
Installation
------------
You can simply download the compiled version as zip file here and inject it
after needed dependencies:
``HTML`
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"
>
src="https://torben.website/clientnode/data/distributionBundle/index.js"
>
src="https://torben.website/internationalisation/data/distributionBundle/index.js"
>
The compiled bundle supports AMD, commonjs, commonjs2 and variable injection
into given context (UMD) as export format: You can use a module bundler if you
want.
If you are using npm as package manager you can simply add this tool to your
package.json as dependency:
`JSON`
...
"dependencies": {
...
"internationalisation": "latest",
...
},
...
After updating your packages you can simply depend on this script and let
a module bundler do the hard stuff or access it via an exported variable name
in given context.
`JavaScript`
...
import Language from 'internationalisation'
class SpecialLanguage extends Language...
Language({options..})
// or
import {$} from 'internationalisation'
$.Language()
class SpecialLanguage extends $.Language.class ...
// or
Language = require('internationalisation').default
value instanceof Language
// or
$ = require('internationalisation').$
$.Language()
...
Usage
-----
To add two versions of a text string you can simply add your translation
directly in markup. See how easy it is:
`HTML`
Your englisch version.
Sometime you need to explicit mark a text node as text to replace with next
translation node. In this case you can simple wrap a self defined dom node.
`HTML`
Your englisch version with dom nodes inside.
It is also possible to use an alternative replacement node.
`HTML`
Your englisch version with dom nodes inside.
Ihre deutsche Variante mit eingebetteten dom Knoten.
Votre version français dom nodes à l'intérieur.
Usually the language dom node precedes the text node to translate. It is
possible to write a special syntax to use a replacement for the next dom node
containing text.
` Your englisch version.HTML`
Its possible to save one translation once if you specify the area with known
translations.
`HTML`title 1
title 2
With the below initialisation you can simple add this links everywhere in your
page to switch language. On click you will switch the current language
interactively. Try it by yourself:
Here you can see a complete initialisation example with all available options
to initialize the plugin with different configuration.
`HTML
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"
>
src="https://torben.website/clientnode/data/distributionBundle/index.js"
>
src="https://torben.website/internationalisation/data/distributionBundle/index.js"
>
``