Drift Angular
  • Overview
  • Package Content
  • Installation and Setup
    • Setup Environment
    • Setup Project
    • Setup Layout
    • Deployment
  • Structure
    • Folders and Files Structure
    • Layouts
    • Drift Icons
  • Stylesheets
    • Overview
    • Sass Variables
    • Layouts & Theme
    • Fonts
    • Colors
    • Back Ground Images
    • Margin & Paddings
    • Theme Customization
    • RTL Version
  • Settings
    • Template Setting
    • Customize Horizontal Menu
    • Customize Vertical Menu
    • Create a Page
    • Define Routes
    • Root Loader
    • RTL
    • Internationalization
  • Components
    • Alerts
    • Badges
    • Breadcrumbs
    • Buttons
    • Button Group
    • Cards
    • Card Group
    • Collapse
    • Dropdowns
    • Progress Bar
    • Tabs
Powered by GitBook
On this page
  • Overview
  • How to add a new language
  • How to use

Was this helpful?

  1. Settings

Internationalization

PreviousRTLNextAlerts

Last updated 5 years ago

Was this helpful?

Overview

The internationalization (i18n) library for Angular by

How to add a new language

To register new language we have to update given below files:

  • src/assets/i18n/*.json

  • src/app/app.component.ts

Duplicate en.json file and create a new language file in src/assets/i18n/*.json. The new file name and the language name must be matched.

Register the language by adding its name to languages array.

translate.addLangs(['en', 'es', 'new lang name']);

How to use

The translator understands nested JSON objects as defined in src/assets/i18n/*.json. This means that you can have a translation that looks like this:

{ "HOME": { "HELLO": "hello " } }

You can then access the value by using the dot notation, in this case HOME.HELLO.

<div [translate]="'HOME.HELLO'" [translateParams]="{value: 'world'}"></div>
ngx-translate