Skip to content

Commit 7b8e4e8

Browse files
add angular-translate-loader-url v2.9.0
1 parent e49b6ec commit 7b8e4e8

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.9.0 - 2016-01-24
3+
*
4+
* Copyright (c) 2016 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+
angular.module('pascalprecht.translate')
23+
/**
24+
* @ngdoc object
25+
* @name pascalprecht.translate.$translateUrlLoader
26+
* @requires $q
27+
* @requires $http
28+
*
29+
* @description
30+
* Creates a loading function for a typical dynamic url pattern:
31+
* "locale.php?lang=en_US", "locale.php?lang=de_DE", "locale.php?language=nl_NL" etc.
32+
* Prefixing the specified url, the current requested, language id will be applied
33+
* with "?{queryParameter}={key}".
34+
* Using this service, the response of these urls must be an object of
35+
* key-value pairs.
36+
*
37+
* @param {object} options Options object, which gets the url, key and
38+
* optional queryParameter ('lang' is used by default).
39+
*/
40+
.factory('$translateUrlLoader', $translateUrlLoader);
41+
42+
function $translateUrlLoader($q, $http) {
43+
44+
'use strict';
45+
46+
return function (options) {
47+
48+
if (!options || !options.url) {
49+
throw new Error('Couldn\'t use urlLoader since no url is given!');
50+
}
51+
52+
var requestParams = {};
53+
54+
requestParams[options.queryParameter || 'lang'] = options.key;
55+
56+
return $http(angular.extend({
57+
url: options.url,
58+
params: requestParams,
59+
method: 'GET'
60+
}, options.$http))
61+
.then(function(result) {
62+
return result.data;
63+
}, function () {
64+
return $q.reject(options.key);
65+
});
66+
};
67+
}
68+
$translateUrlLoader.$inject = ['$q', '$http'];
69+
70+
$translateUrlLoader.displayName = '$translateUrlLoader';
71+
return 'pascalprecht.translate';
72+
73+
}));

ajax/libs/angular-translate-loader-url/2.9.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.8.1",
5+
"version": "2.9.0",
66
"homepage": "http://angular-translate.github.io",
77
"keywords": [
88
"framework",

0 commit comments

Comments
 (0)