npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ng.locale

v0.4.1

Published

Module for AngularJS easy localization.

Readme

Module for AngularJS easy localization.

Install

npm install ng.locale After installation you should add 'ng.locale' as a required module to your app.

Configuration

There is one way to configure ngLocale module. For this you should add ngLocaleConfigProvider to your app config section and add a list of params:

ngLocaleConfigProvider.$get('setConfig').setConfig({
    localUrl: 'locale_url',
    restUrl: 'rest_url',
    prefix: 'your_prefix',
    toStore: false
});
  • locale_url - it's yor locale url for localization. usually it's link to local static json file
  • rest_url - if you want to request localization from a server
  • prefix - if you have a prefix in your localization keys
  • toStore - if you want module to store localization in local storage, then you should choose true for this option.

Additionally, if you have a need to add something during the work of your application or you want to edit your localization in store, you can do it like that:

ngLocaleService.$$add(localeObject);

where

  • localeObject - custom object with { key: value } pairs, which will extend your locale object if it exists or just add new values if it does not

It is important to know, that you should not add prefix to your keys, because method will use prefix from the configuration.

How to use

As attribute To use module as an attribute you should just write this:

<span ng-locale="locale_key"></span>
<span ng-locale="{{$scope.localeKey}}"></span>

Module will bind localized value to this span element. If attribute does not find the value for your key, it will return empty string as a result (using service).

As a filter If you want to use module as a filter, you can write this:

{{ 'locale_key' | localize }}

and the key will be replaced with localized value. If filter does not find the value for your key, it will return undefined as a result.

As a service in controller If you want to use module in your code, first of all you should add ngLocaleService as a DI to your controller/service. Then you can use service like this:

var self = this;
ngLocaleService.$$get('locale_key').then(function (response) {
  self.translate = response;
});

If service does not find the value for your key, it will return empty string as a result.

Also, if you need to localize more than one key, you should just add all of them as parameters:

var self = this;
ngLocaleService.$$get('key1', 'key2', 'key3').then(function (response) {
  self.key1 = response['key1'];
  self.key2 = response['key2'];
  self.key3 = response['key3'];
});

In that case service will return object, where keys will be your params and values for this keys - localized strings (or empty string).

If you find bug or you have any idea how to do better, I'll be glad to here about it and to improve ngLocale for you.