├── .editorconfig ├── .github └── ISSUE_TEMPLATE │ ├── Bug_report.md │ ├── Feature_request.md │ └── Support_request.md ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── angular.json ├── package-lock.json ├── package.json ├── projects └── ngx-translate │ └── http-loader │ ├── karma.conf.js │ ├── ng-package.json │ ├── package.json │ ├── src │ ├── lib │ │ └── http-loader.ts │ └── public_api.ts │ ├── test.ts │ ├── tests │ └── http-loader.spec.ts │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ ├── tsconfig.spec.json │ └── tslint.json ├── tsconfig.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "⚠️ Bug report" 3 | about: Report a bug for this library. Please check the FAQ and search github/stackoverflow 4 | for a similar issue before submitting 5 | 6 | --- 7 | 8 | 13 | 14 | ## Current behavior 15 | 16 | 17 | 18 | ## Expected behavior 19 | 20 | 21 | 22 | ## How do you think that we should fix this? 23 | 24 | 25 | 26 | ## Minimal reproduction of the problem with instructions 27 | 31 | 32 | 33 | ## Environment 34 | 35 |
36 | ngx-translate version: X.Y.Z
37 | Angular version: X.Y.Z
38 |
39 |
40 | Browser:
41 | - [ ] Chrome (desktop) version XX
42 | - [ ] Chrome (Android) version XX
43 | - [ ] Chrome (iOS) version XX
44 | - [ ] Firefox version XX
45 | - [ ] Safari (desktop) version XX
46 | - [ ] Safari (iOS) version XX
47 | - [ ] IE version XX
48 | - [ ] Edge version XX
49 |
50 | For Tooling issues:
51 | - Node version: XX
52 | - Platform:
53 |
54 | Others:
55 |
56 |
57 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/Feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "✨ Feature request"
3 | about: Suggesting new features for this library. Please check if a similar feature
4 | request exists before submitting
5 |
6 | ---
7 |
8 |
13 |
14 | ## Current behavior
15 |
16 |
17 |
18 | ## Expected behavior
19 |
20 |
21 |
22 | ## What is the motivation / use case for changing the behavior?
23 |
24 |
25 |
26 | ## How do you think that we should implement this?
27 |
28 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/Support_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: ℹ️ Other / Support request
3 | about: Please check the FAQ and search github/stackoverflow for a similar issue before
4 | submitting
5 |
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 |
8 | # dependencies
9 | /node_modules
10 |
11 | # IDEs and editors
12 | /.idea
13 | .project
14 | .classpath
15 | .c9/
16 | *.launch
17 | .settings/
18 | *.sublime-workspace
19 |
20 | # IDE - VSCode
21 | .vscode/*
22 | !.vscode/settings.json
23 | !.vscode/tasks.json
24 | !.vscode/launch.json
25 | !.vscode/extensions.json
26 |
27 | # misc
28 | /.sass-cache
29 | /connect.lock
30 | /coverage
31 | /libpeerconnection.log
32 | npm-debug.log
33 | yarn-error.log
34 | testem.log
35 | /typings
36 |
37 | # System Files
38 | .DS_Store
39 | Thumbs.db
40 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | sudo: required
3 | notifications:
4 | email: false
5 | node_js:
6 | - '10'
7 | before_install:
8 | - if [[ `npm -v` != 6* ]]; then npm i -g npm@6; fi
9 | services:
10 | - xvfb
11 | addons:
12 | chrome: stable
13 | after_success:
14 | - npm run build
15 | - cp .git dist/@ngx-translate/http-loader/ -r # required by semantic release
16 | - cp README.md dist/@ngx-translate/http-loader/
17 | - cd dist/@ngx-translate/http-loader/
18 | - npm install semantic-release@8.2.3 --no-save
19 | - npm run semantic-release
20 | branches:
21 | except:
22 | - /^v\d+\.\d+\.\d+$/
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2018 Olivier Combe
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # @ngx-translate/http-loader [](https://travis-ci.org/ngx-translate/http-loader) [](https://badge.fury.io/js/%40ngx-translate%2Fhttp-loader)
2 |
3 | A loader for [ngx-translate](https://github.com/ngx-translate/core) that loads translations using http.
4 |
5 | ----------
6 |
7 | **⚠️ The content of this repository was moved to the main [ngx-translate repository](https://github.com/ngx-translate/core)**
8 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "@ngx-translate/http-loader": {
7 | "root": "projects/ngx-translate/http-loader",
8 | "sourceRoot": "projects/ngx-translate/http-loader/src",
9 | "projectType": "library",
10 | "prefix": "lib",
11 | "architect": {
12 | "build": {
13 | "builder": "@angular-devkit/build-ng-packagr:build",
14 | "options": {
15 | "tsConfig": "projects/ngx-translate/http-loader/tsconfig.lib.json",
16 | "project": "projects/ngx-translate/http-loader/ng-package.json"
17 | },
18 | "configurations": {
19 | "production": {
20 | "tsConfig": "projects/ngx-translate/http-loader/tsconfig.lib.prod.json"
21 | }
22 | }
23 | },
24 | "test": {
25 | "builder": "@angular-devkit/build-angular:karma",
26 | "options": {
27 | "main": "projects/ngx-translate/http-loader/test.ts",
28 | "tsConfig": "projects/ngx-translate/http-loader/tsconfig.spec.json",
29 | "karmaConfig": "projects/ngx-translate/http-loader/karma.conf.js"
30 | }
31 | },
32 | "lint": {
33 | "builder": "@angular-devkit/build-angular:tslint",
34 | "options": {
35 | "tsConfig": [
36 | "projects/ngx-translate/http-loader/tsconfig.lib.json",
37 | "projects/ngx-translate/http-loader/tsconfig.spec.json"
38 | ],
39 | "exclude": [
40 | "**/node_modules/**"
41 | ]
42 | }
43 | }
44 | }
45 | }
46 | },
47 | "defaultProject": "@ngx-translate/http-loader"
48 | }
49 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ngx-translate/http-loader",
3 | "description": "A loader for ngx-translate that loads translations using http",
4 | "scripts": {
5 | "build": "ng build",
6 | "commit": "git-cz",
7 | "lint": "ng lint",
8 | "ng": "ng",
9 | "start": "ng serve",
10 | "test": "ng test"
11 | },
12 | "private": true,
13 | "dependencies": {
14 | "@angular/common": "^10.0.0",
15 | "@angular/compiler": "^10.0.0",
16 | "@angular/core": "^10.0.0",
17 | "@angular/platform-browser": "^10.0.0",
18 | "@angular/platform-browser-dynamic": "^10.0.0",
19 | "@ngx-translate/core": ">=12.0.0",
20 | "core-js": "^3.6.5",
21 | "rxjs": "^6.5.5",
22 | "tslib": "^2.0.0",
23 | "zone.js": "~0.10.3"
24 | },
25 | "devDependencies": {
26 | "@angular-devkit/build-angular": "~0.1000.0",
27 | "@angular-devkit/build-ng-packagr": "~0.1000.0",
28 | "@angular/cli": "^10.0.0",
29 | "@angular/compiler-cli": "^10.0.0",
30 | "@angular/language-service": "^10.0.0",
31 | "@types/jasmine": "^2.8.9",
32 | "@types/jasminewd2": "^2.0.5",
33 | "@types/node": "^12.11.1",
34 | "codelyzer": "^5.1.2",
35 | "commitizen": "2.9.6",
36 | "cz-conventional-changelog": "2.1.0",
37 | "jasmine-core": "~2.99.1",
38 | "jasmine-spec-reporter": "^4.2.1",
39 | "karma": "^3.1.1",
40 | "karma-chrome-launcher": "^2.2.0",
41 | "karma-coverage-istanbul-reporter": "^2.0.4",
42 | "karma-jasmine": "^1.1.2",
43 | "karma-jasmine-html-reporter": "^1.3.1",
44 | "karma-mocha-reporter": "^2.2.5",
45 | "lerna": "^2.11.0",
46 | "ng-packagr": "^10.0.0",
47 | "ts-node": "^8.10.2",
48 | "tslint": "^6.1.2",
49 | "typescript": "^3.9.5"
50 | },
51 | "config": {
52 | "commitizen": {
53 | "path": "./node_modules/cz-conventional-changelog"
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/projects/ngx-translate/http-loader/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | var configuration = {
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | 'karma-jasmine',
10 | 'karma-chrome-launcher',
11 | 'karma-mocha-reporter',
12 | 'karma-coverage-istanbul-reporter',
13 | '@angular-devkit/build-angular/plugins/karma'
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../../../coverage'),
20 | reports: ['html', 'lcovonly'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['mocha'],
24 | mochaReporter: {
25 | ignoreSkipped: true
26 | },
27 | port: 9876,
28 | colors: true,
29 | logLevel: config.LOG_INFO,
30 | autoWatch: !process.env.TRAVIS,
31 | browsers: ['Chrome'],
32 | customLaunchers: {
33 | ChromeTravisCi: {
34 | base: 'Chrome',
35 | flags: ['--no-sandbox']
36 | }
37 | },
38 | singleRun: process.env.TRAVIS
39 | };
40 |
41 | if (process.env.TRAVIS){
42 | config.browsers = [
43 | 'ChromeTravisCi'
44 | ];
45 | }
46 |
47 | config.set(configuration);
48 | };
49 |
--------------------------------------------------------------------------------
/projects/ngx-translate/http-loader/ng-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3 | "dest": "../../../dist/@ngx-translate/http-loader",
4 | "deleteDestPath": false,
5 | "keepLifecycleScripts": true,
6 | "lib": {
7 | "entryFile": "src/public_api.ts"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/projects/ngx-translate/http-loader/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ngx-translate/http-loader",
3 | "description": "A loader for ngx-translate that loads translations using http",
4 | "author": "Olivier Combe",
5 | "keywords": [
6 | "angular",
7 | "angular 2",
8 | "i18n",
9 | "translate",
10 | "ngx-translate"
11 | ],
12 | "license": "MIT",
13 | "homepage": "https://github.com/ngx-translate/http-loader",
14 | "repository": {
15 | "type": "git",
16 | "url": "git+https://github.com/ngx-translate/http-loader.git"
17 | },
18 | "bugs": {
19 | "url": "https://github.com/ngx-translate/http-loader/issues"
20 | },
21 | "peerDependencies": {
22 | "@ngx-translate/core": ">=13.0.0",
23 | "@angular/common": ">=10.0.0",
24 | "rxjs": ">=6.5.3"
25 | },
26 | "scripts": {
27 | "semantic-release": "semantic-release pre && npm publish && semantic-release post"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/projects/ngx-translate/http-loader/src/lib/http-loader.ts:
--------------------------------------------------------------------------------
1 | import {HttpClient} from "@angular/common/http";
2 | import {TranslateLoader} from "@ngx-translate/core";
3 | import {Observable} from 'rxjs';
4 |
5 | export class TranslateHttpLoader implements TranslateLoader {
6 | constructor(private http: HttpClient, public prefix: string = "/assets/i18n/", public suffix: string = ".json") {}
7 |
8 | /**
9 | * Gets the translations from the server
10 | */
11 | public getTranslation(lang: string): Observable