Skip to content

uiwebkit/localize-angular

Repository files navigation

Uni Localization example for Angular

Check out demo here

Check out our docs here

Add to your modules

@NgModule({
  ...,
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  ...
})

Add to index.html

<script type="module" src="https://cdn.jsdelivr.net/npm/@uiwebkit/[email protected]/dist/flag/flag.esm.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@uiwebkit/[email protected]/dist/udk.esm.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@uiwebkit/[email protected]/dist/mat.esm.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@uiwebkit/[email protected]/dist/loc/loc.esm.js"></script>

Place Uni Language Menu into the header of your web app. Specify the path to the language list JSON file (ex. lang-menu.json) or backend API endpoint

<uni-router shadow></uni-router>
<uni-lang-menu-shadow mini round routing url="assets/json/lang-menu.json"></uni-lang-menu-shadow>

Wrap your content with Uni Translate globally (for more convenience)

<uni-translate>
  <your-component></your-component>
</uni-translate>

or wrap your text content with Uni Translate locally (for better performance)

<uni-translate>localized content</uni-translate>

localize partially

<uni-translate>text and (( partially localized ))</uni-translate>

localize attributes

<uni-translate>
  <a href="https://your_domain/(( localized ))">link</a>
</uni-translate>

open and modify ./src/assets/json/lang-menu.json and translation files into ./src/assets/json/i18n/ folder