Gathering detailed insights and metrics for angular-translate-loader
Gathering detailed insights and metrics for angular-translate-loader
Gathering detailed insights and metrics for angular-translate-loader
Gathering detailed insights and metrics for angular-translate-loader
@ngx-translate/http-loader
http loader for dynamically loading translation files for @ngx-translate/core
angular-translate-loader-static-files
Creates a loading function for a typical static file url pattern: "lang-en_US.json", "lang-de_DE.json", etc. Using this builder, the response of these urls must be an object of key-value pairs.
angular-translate-loader-partial
angular-translate-loader-partial
angular-translate-loader-url
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}"
"angular-translate" loader for webpack
npm install angular-translate-loader
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
15 Stars
83 Commits
2 Forks
1 Watchers
112 Branches
5 Contributors
Updated on Jan 28, 2023
Latest Version
1.6.2
Package Id
angular-translate-loader@1.6.2
Unpacked Size
59.58 kB
Size
15.44 kB
File Count
36
NPM Version
5.6.0
Node Version
8.11.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
1
angular-translate
loader for webpack
This loader helps to reduce writing the boilerplate code for angular-translate
.
1npm install angular --save && npm install angular-translate-loader --save-dev
or
1yarn add angular && yarn add angular-translate-loader --dev
Instead of writing boilerplate code something like this:
1var angular = require("angular"); 2var translations = angular.module('translations', ['pascalprecht.translate']); 3 4translations.config(function($translateProvider) { 5 $translateProvider.translations('en_US', { 6 foo: 'bar', 7 bar: { 8 baz: 'qux' 9 } 10 }); 11});
You can do that in single line:
./index.js
1var translations = require('!json!angular-translate?module=translations!./index.json'); 2 3console.log(translations); // Object { foo: "bar", bar: { baz: "qux" } }
and the loader will do all work for you:
1var angular = require("angular"); 2var translations = { 3 foo: "bar", 4 bar: { 5 baz: "qux" 6 } 7}; 8var module; 9try { 10 module = angular.module("translations"); 11} catch(err) { 12 module = angular.module("translations", ["pascalprecht.translate"]); 13} 14module.config(["$translateProvider", function($translateProvider) { 15 $translateProvider.translations("en_US", translations); 16}]); 17module.exports = translations;
Also it detects locales in the requested file (please see localeInterpolate
option):
./de_DE.json
1{ 2 "foo": "Bar", 3 "bar": { 4 "baz": "Qux" 5 } 6}
./index.js
1var translations = require('!json!angular-translate?module=translations!./index.json'); 2 3console.log(translations); // Object { foo: "Bar", bar: { baz: "Qux" } }
1var angular = require("angular"); 2var translations = { 3 foo: "Bar", 4 bar: { 5 baz: "Qux" 6 } 7}; 8var module; 9try { 10 module = angular.module("translations"); 11} catch(err) { 12 module = angular.module("translations", ["pascalprecht.translate"]); 13} 14module.config(["$translateProvider", function($translateProvider) { 15 $translateProvider.translations("de_DE", translations); 16}]); 17module.exports = translations;
Also if you want to require all translations at once you can do that as well:
./index.js
1var angular = require('angular'); 2 3function requireAll(requireContext) { 4 return requireContext.keys().map(requireContext); 5} 6 7requireAll(require.context('./locales', true, /\.json$/)); 8 9angular.module('app', ['translations']);
If you want to add some global options you can do that easily:
./webpack.config.js
1module.exports = { 2 module: { 3 rules: [{ 4 type: 'javascript/auto', 5 test: /\.json$/, 6 loader: 'angular-translate-loader', 7 options: { 8 module: 'translations', 9 namespaces: ['app', '[dir]'], 10 sep: '.', 11 defaultLocale: 'de_DE' 12 } 13 }] 14 } 15};
Name | Type | Default Value | Description |
---|---|---|---|
module | String or String[] | 'translations' | Sets name of angular module. Supports interpolations and also [dir] . |
namespaces | String or String[] | '' | Adds namespaces to each translations key. Supports interpolations and also [dir] . |
sep | String | '/' | Separator for namespaces and module . |
localeInterpolate | RegExp or RegExp[] or String or String[] | [/_[a-z]{2}_[A-Z]{2}\./, /_[a-z]{2}\./, /[/\\][a-z]{2}_[A-Z]{2}[/\\]/, /[/\\][a-z]{2}[/\\]/] | Uses to detect locale in resourcePath . |
defaultLocale | String | 'en_US' | Uses defaultLocale if localeInterpolate fails to detect it. |
requireAngular | Boolean | true | Indicates whether to add var angular = require("angular") to generated code or not. Defaults to true . |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 5/28 approved changesets -- score normalized to 1
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
114 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More