Skip to content

Commit 9738f87

Browse files
committed
Add angular-translate-loader-url v2.14.0
1 parent 1f2e129 commit 9738f87

File tree

3 files changed

+80
-1
lines changed

3 files changed

+80
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*!
2+
* angular-translate - v2.14.0 - 2017-02-11
3+
*
4+
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
5+
*/
6+
(function (root, factory) {
7+
if (typeof define === 'function' && define.amd) {
8+
// AMD. Register as an anonymous module unless amdModuleId is set
9+
define([], function () {
10+
return (factory());
11+
});
12+
} else if (typeof exports === 'object') {
13+
// Node. Does not work with strict CommonJS, but
14+
// only CommonJS-like environments that support module.exports,
15+
// like Node.
16+
module.exports = factory();
17+
} else {
18+
factory();
19+
}
20+
}(this, function () {
21+
22+
$translateUrlLoader.$inject = ['$q', '$http'];
23+
angular.module('pascalprecht.translate')
24+
/**
25+
* @ngdoc object
26+
* @name pascalprecht.translate.$translateUrlLoader
27+
* @requires $q
28+
* @requires $http
29+
*
30+
* @description
31+
* Creates a loading function for a typical dynamic url pattern:
32+
* "locale.php?lang=en_US", "locale.php?lang=de_DE", "locale.php?language=nl_NL" etc.
33+
* Prefixing the specified url, the current requested, language id will be applied
34+
* with "?{queryParameter}={key}".
35+
* Using this service, the response of these urls must be an object of
36+
* key-value pairs.
37+
*
38+
* @param {object} options Options object, which gets the url, key and
39+
* optional queryParameter ('lang' is used by default).
40+
*/
41+
.factory('$translateUrlLoader', $translateUrlLoader);
42+
43+
function $translateUrlLoader($q, $http) {
44+
45+
'use strict';
46+
47+
return function (options) {
48+
49+
if (!options || !options.url) {
50+
throw new Error('Couldn\'t use urlLoader since no url is given!');
51+
}
52+
53+
var requestParams = {};
54+
55+
requestParams[options.queryParameter || 'lang'] = options.key;
56+
57+
return $http(angular.extend({
58+
url: options.url,
59+
params: requestParams,
60+
method: 'GET'
61+
}, options.$http))
62+
.then(function(result) {
63+
return result.data;
64+
}, function () {
65+
return $q.reject(options.key);
66+
});
67+
};
68+
}
69+
70+
$translateUrlLoader.displayName = '$translateUrlLoader';
71+
return 'pascalprecht.translate';
72+
73+
}));

ajax/libs/angular-translate-loader-url/2.14.0/angular-translate-loader-url.min.js

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ajax/libs/angular-translate-loader-url/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "angular-translate-loader-url",
33
"filename": "angular-translate-loader-url.min.js",
44
"description": "Creates a loading function for a typical dynamic url pattern: \"locale.php?lang=en_US\", \"locale.php?lang=de_DE\", \"locale.php?language=nl_NL\" etc. Prefixing the specified url, the current requested, language id will be applied with \"?{queryParameter}={key}\". Using this service, the response of these urls must be an object of key-value pairs.",
5-
"version": "2.13.1",
5+
"version": "2.14.0",
66
"homepage": "http://angular-translate.github.io",
77
"keywords": [
88
"framework",

0 commit comments

Comments
 (0)