GithubHelp home page GithubHelp logo

ng-l20n's Introduction

ng-l20n Build Status

An AngularJS module handling the l20n localization library.

Usage

Usage is simple - just use a data-l20n attribute with an l20n identificator (with a stock l20n you'd use data-l10n-id instead) so tutorials from http://l20n.org still apply with this little change.

An example sandbox is included. You can freely use Angular expressions inside the attribute, they will be parsed for you before passing to l20n.

Configuration

Locale is stored in localStorage. The localStorage key as well al the $rootScope property that stores the locale are customizable:

myApp.config(["l20nProvider", function(l20nProvider) {
  l20nProvider.localeStorageKey = 'myAppLocaleKey';    // default: 'locale'
  l20nProvider.localeProperty = 'myAppLocale';         // default: none
}]);

If the localeProperty is not specified, nothing will be saved to $rootScope.

Minification and linting

Minification and linting is supported via Grunt tasks. To obtain the minified file together with the sourcemap, first install a global grunt-cli package:

npm -g install grunt-cli

Then install local npm packages:

npm install

After performing these steps, invoking:

grunt

will lint & build the files; you can copy all 3 files (ng-l20n.js, ng-l20n.min.js, ng-l20n.min.map) from the dist/ folder.

Notes

ng-l20n requires l20n.js in version 1.0 or newer.

License

The module is available under the MIT license (see MIT-LICENSE.txt for details).

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.