Translations
<zn-translations> | ZnTranslations
The Translations component allows users to enter text for multiple languages, with a tabbed interface for switching between languages.
<zn-translations></zn-translations>
Attributes
| Attribute | Type | Description |
|---|---|---|
languages |
Object |
A key-value pair of language codes and names (e.g.,
{ "en": "English", "fr": "French" }).
|
values |
Object |
A key-value pair of language codes and translations. |
value |
String |
A JSON string representing the current translations. |
Examples
With Label
<zn-translations label="Description" languages='{"en":"English","fr":"French","de":"German"}'> </zn-translations>
Custom Languages
You can provide a custom list of available languages via the languages property.
<zn-translations languages='{"en":"English","fr":"French","de":"German","es":"Spanish","it":"Italian","pt":"Portuguese","ru":"Russian","zh":"Chinese","ja":"Japanese","ar":"Arabic"}'></zn-translations>
Pre-filled Values
<zn-translations languages='{"en":"English","fr":"French"}' values='{"en":"Hello World","fr":"Bonjour le monde"}' ></zn-translations>
Importing
If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.
To import this component from the CDN using a script tag:
<script type="module" src="https://cdn.jsdelivr.net/npm/@kubex/zinc@1.0.23/dist/components/translations/translations.js"></script>
To import this component from the CDN using a JavaScript import:
import 'https://cdn.jsdelivr.net/npm/@kubex/zinc@1.0.23/dist/components/translations/translations.js';
To import this component using a bundler:
import '@kubex/zinc/dist/components/translations/translations.js';