Git Product home page Git Product logo

angular-l10n's Introduction

Angular localization

Build Status npm version

An Angular library to translate messages, dates and numbers.

This library is for localization of Angular 2+ apps written in TypeScript, ES6 or ES5. It allows, in addition to translation, to localize numbers and dates of your app, adding language code, country code, and optionally script code, numbering system and calendar, through Internationalization API. It also implements the validation of numbers by locales.

Sample app built with Angular Material, AoT compilation & webpack, and its source code.

Get the changelog by releases.

Angular i18n solutions

Feature Angular Native ngx-translate External library angular-l10n External library
Messages Html attribute, message ID directive, impure pipe directive, pure pipe
File formats XLIFF, XMB/XTB JSON JSON
No bootstrap (when language changes) no yes yes
Getting the translation in component class not yet yes yes
Numbers pure pipe via Intl - directive & pure pipe via Intl
Dates pure pipe via Intl - directive & pure pipe via Intl
Validation - - numbers validation

Installing

You can add angular-l10n to your project using npm:

npm install angular-l10n --save 

Loading

Using SystemJS configuration

System.config({
    map: {
        'angular-l10n': 'node_modules/angular-l10n/bundles/angular-l10n.umd.js'
    }
});

Angular-CLI

No need to set up anything, just import it in your code.

Rollup or webpack

No need to set up anything, just import it in your code.

Plain JavaScript

If you build apps in Angular using ES5, you can include the umd bundle in your index.html:

<script src="node_modules/angular-l10n/bundles/angular-l10n.umd.js"></script>

and use global ng.l10n namespace.

AoT compilation & Server-side prerendering

This library is compatible with AoT compilation & Server-side prerendering.

Usage

See quick start and library specification.

Related projects

Angular Localization with an ASP.NET CORE MVC Service @damienbod

Building

In order to build the library if you want to contribute to it:

npm install
npm test
npm run build

To test locally the npm package:

npm run pack-lib

Then you can install it in your app to test it:

npm install [path]angular-l10n-[version].tgz

License

MIT

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.