Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
angular-translate-loader-url
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Custom Issue Tracker
Custom Issue Tracker
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
angularjs
angular-translate-loader-url
Commits
c5cf29f5
Commit
c5cf29f5
authored
Mar 21, 2021
by
bingchuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] version 2.18.4
parent
4784b7d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
46 deletions
+46
-46
angular-translate-loader-url.js
angular-translate-loader-url.js
+46
-46
No files found.
angular-translate-loader-url.js
View file @
c5cf29f5
/*!
/*!
* angular-translate - v2.1
3.1 - 2016-12-06
* angular-translate - v2.1
8.4 - 2021-01-14
*
*
* Copyright (c) 20
16
The angular-translate team, Pascal Precht; Licensed MIT
* Copyright (c) 20
21
The angular-translate team, Pascal Precht; Licensed MIT
*/
*/
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
if
(
typeof
define
===
'function'
&&
define
.
amd
)
{
if
(
typeof
define
===
'function'
&&
define
.
amd
)
{
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
define
([],
function
()
{
define
([],
function
()
{
return
(
factory
());
return
(
factory
());
});
});
}
else
if
(
typeof
exports
===
'object'
)
{
}
else
if
(
typeof
module
===
'object'
&&
module
.
exports
)
{
// Node. Does not work with strict CommonJS, but
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// only CommonJS-like environments that support module.exports,
// like Node.
// like Node.
...
@@ -19,55 +19,55 @@
...
@@ -19,55 +19,55 @@
}
}
}(
this
,
function
()
{
}(
this
,
function
()
{
$translateUrlLoader
.
$inject
=
[
'$q'
,
'$http'
];
$translateUrlLoader
.
$inject
=
[
'$q'
,
'$http'
];
angular
.
module
(
'pascalprecht.translate'
)
angular
.
module
(
'pascalprecht.translate'
)
/**
/**
* @ngdoc object
* @ngdoc object
* @name pascalprecht.translate.$translateUrlLoader
* @name pascalprecht.translate.$translateUrlLoader
* @requires $q
* @requires $q
* @requires $http
* @requires $http
*
*
* @description
* @description
* Creates a loading function for a typical dynamic url pattern:
* 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.
* "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
* Prefixing the specified url, the current requested, language id will be applied
* with "?{queryParameter}={key}".
* with "?{queryParameter}={key}".
* Using this service, the response of these urls must be an object of
* Using this service, the response of these urls must be an object of
* key-value pairs.
* key-value pairs.
*
*
* @param {object} options Options object, which gets the url, key and
* @param {object} options Options object, which gets the url, key and
* optional queryParameter ('lang' is used by default).
* optional queryParameter ('lang' is used by default).
*/
*/
.
factory
(
'$translateUrlLoader'
,
$translateUrlLoader
);
.
factory
(
'$translateUrlLoader'
,
$translateUrlLoader
);
function
$translateUrlLoader
(
$q
,
$http
)
{
function
$translateUrlLoader
(
$q
,
$http
)
{
'use strict'
;
'use strict'
;
return
function
(
options
)
{
return
function
(
options
)
{
if
(
!
options
||
!
options
.
url
)
{
if
(
!
options
||
!
options
.
url
)
{
throw
new
Error
(
'Couldn
\'
t use urlLoader since no url is given!'
);
throw
new
Error
(
'Couldn
\'
t use urlLoader since no url is given!'
);
}
}
var
requestParams
=
{};
var
requestParams
=
{};
requestParams
[
options
.
queryParameter
||
'lang'
]
=
options
.
key
;
requestParams
[
options
.
queryParameter
||
'lang'
]
=
options
.
key
;
return
$http
(
angular
.
extend
({
return
$http
(
angular
.
extend
({
url
:
options
.
url
,
url
:
options
.
url
,
params
:
requestParams
,
params
:
requestParams
,
method
:
'GET'
method
:
'GET'
},
options
.
$http
))
},
options
.
$http
))
.
then
(
function
(
result
)
{
.
then
(
function
(
result
)
{
return
result
.
data
;
return
result
.
data
;
},
function
()
{
},
function
()
{
return
$q
.
reject
(
options
.
key
);
return
$q
.
reject
(
options
.
key
);
});
});
};
};
}
}
$translateUrlLoader
.
displayName
=
'$translateUrlLoader'
;
$translateUrlLoader
.
displayName
=
'$translateUrlLoader'
;
return
'pascalprecht.translate'
;
return
'pascalprecht.translate'
;
}));
}));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment