Git Product home page Git Product logo

i18n's Introduction

I18n module based on the @ngx-translate/core package.

Installation

yarn add @ngsm/i18n or npm i @ngsm/i18n --save

Usage

App module:

import { I18nModule } from '@ngsm/i18n';
...

@NgModule({
  imports: [
    ...
    // Option 1: module without paramaters 
    I18nModule,
    // Option 2: module with parameters
    // Add new langs to the list. Default language should be added as a first.
    I18nModule.forRoot({ 
      languages: ['en', 'pl']
    }),
  ],
  ...
})
export class AppModule {}

Translations should be added in i18n directory in your assets (for example /src/assets/i18n/en.json):

{
  "homepage": {
    "title": "My title"
  }
}

In your HTML:

{{ 'homepage.title' | translate }}

Author

Sebastian Musiał

[email protected]

@sebamusial

i18n's People

Contributors

dependabot[bot] avatar sebastianmusial avatar

Watchers

 avatar

i18n's Issues

Compability with Angular Ivy

The same error as here

    ERROR in node_modules/@ngsm/i18n/lib/i18n.module.d.ts:4:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
    
    This likely means that the library (@ngsm/i18n) which declares I18nModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if s
o. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.