<uni-event-load
url="https://uni.github.io/json/lang-store-flag.json"
prop="value"
>
<uni-lang-menu></uni-lang-menu>
</uni-event-load>
<uni-translate>
This content is localized
</uni-translate>
Uni Localize is a set of Web Components & Custom Elements for adding multilingual support to your website and customize it in the declarative style.
Uni Localize components have three modes:
- Custom Element -
100%
convenience; - Web Component -
100%
security; - Custom Element with 'only' prop -
100%
customization;
Uni Localize takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components & Custom Elements that run in any browser supporting the Custom Elements v1 spec.
Uni Localize components are just HTML Web Components & Custom Elements, so they work in any major framework or with no framework at all.
Clone this repo to a new directory:
git clone https://github.com/uiwebkit/localize.git uni-localize
cd uni-localize
and run:
npm i
npm run serve:dev
To build the component for production, run:
npm run build:prod
Check out our docs here.
When creating new component tags, use uni
in the component name (ex: <uni-translate>
) or use a prefix that fits your company or any name for a group of related components. For example, all the UiWebKit generated Web Components & Custom Elements use the prefix uni
.
There are two strategies we recommend for using Uni Localization:
- Put a script tag
<script type="module" src="https://cdn.jsdelivr.net/npm/@uiwebkit/loc@latest/dist/loc/loc.esm.js"></script>
in the head of your index.html - Then you can use web components and custom elements anywhere in your Template, JSX, HTML, etc.;
- Run
npm i @uiwebkit/loc --save
; - Paste
import @uiwebkit/loc;
into the main JS/TS file; - Then you can use web components and custom elements anywhere in your Template, JSX, HTML, etc.;