gettextCatalog service


angular.module("myApp").controller("MyCtrl", function ($scope, gettextCatalog) {
    // Do things with gettextCatalog




Sets the current language and makes sure that all translations get updated correctly.


Returns the current language.

setStrings(language, strings)

Processes an object of string definitions. More details here.

getString(string, scope, context)

Translate a string with the given scope and context. Uses Angular.JS interpolation, so something like this will do what you expect:

var hello = gettextCatalog.getString("Hello {{name}}!", { name: "Ruben" });
// var hello will be "Hallo Ruben!" in Dutch.

The context parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster.

getPlural(n, string, stringPlural, context)

Translate a plural string with the given context.


Load a set of translation strings from a given URL. This should be a JSON catalog generated with grunt-angular-gettext. More details here.

translate directive

See Using the translate directive.

translate filter

See Using the translate filter.