angular.l10n

A small and simple provider for changing locale in angular
Homepage:
1 person uses it
Author: 1777517?v=3 troch

angular-l10n

A small and simple provider for changing locale in angular. To use, import module 'troch.l10n' in your app.

Building library

By default, no locales are included in angular-l10n.js. All locales available with angularjs can be used in your applicaation. For including locales you need in your app:

With grunt

Run the following command line with the locales you want to be available in your angular application. Example: grunt --locales=['en-gb', 'fr-fr']

Without grunt

Simply replace /*LOCALES_HERE*/ in angular-l10n.js by the locales required in your application. All the locales are located in folders locale/js or locale/min (non-uglified and uglified files). The final file should look like this:

How to use

Set locale in app config

This will set the locale your application will start with.

Change locale from anywhere in your app

$l10n needs to be injected in your controller or directive

comments powered by Disqus
This page was last updated over 3 years ago.