var myApp = angular.module('myApp', ['gettext']);
myApp.run(function ($rootScope, gettextCatalog) {
$rootScope.message = 'welcome';
gettextCatalog.setCurrentLanguage('fr');
gettextCatalog.loadRemote('https://bits.ivancarosati.com/s/some.html');
});
/**
* @ngdoc module
* @name gettext
* @packageName angular-gettext
* @description Super simple Gettext for Angular.JS
*
* A sample application can be found at https://github.com/rubenv/angular-gettext-example.
* This is an adaptation of the [TodoMVC](http://todomvc.com/) example. You can use this as a guideline while adding {@link angular-gettext angular-gettext} to your own application.
*/
/**
* @ngdoc factory
* @module gettext
* @name gettextPlurals
* @param {String} [langCode=en] language code
* @param {Number} [n=0] number to calculate form for
* @returns {Number} plural form number
* @description Provides correct plural form id for the given language
*
* Example
* ```js
* gettextPlurals('ru', 10); // 1
* gettextPlurals('en', 1); // 0
* gettextPlurals(); // 1
* ```
*/
angular.module('gettext', []);
/**
* @ngdoc object
* @module gettext
* @name gettext
* @kind function
* @param {String} str annotation key
* @description Gettext constant function for annotating strings
*
* ```js
* angular.module('myApp', ['gettext']).config(function(gettext) {
* /// MyApp document title
* gettext('my-app.title');
* ...
* })
* ```
*/
angular.module('gettext').constant('gettext', function (str) {
/*
* Does nothing, simply returns the input string.
*
* This function serves as a marker for `grunt-angular-gettext` to know that
* this string should be extracted for translations.
*/
return str;
});
/**
* @ngdoc service
* @module gettext
* @name gettextCatalog
* @requires gettextPlurals
* @requires gettextFallbackLanguage
* @requires https://docs.angularjs.org/api/ng/service/$http $http
* @requires...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.