api-angular-academia-intl 0.1.4-beta.5 → 0.1.4-beta.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,38 +1,38 @@
1
-
2
- # ApiAngularAcademiaI18n
3
-
4
- This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.7.3.
5
-
6
- ## Install CopyFiles Dependency
7
-
8
- Install this dependencies to build the project correctly.
9
-
10
- `npm install copyfiles -g`
11
-
12
- `npm i gulp-merge-json`
13
-
14
- `npm install gulp-jsonminify --save-dev`
15
-
16
- ## Development server
17
-
18
- Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
19
-
20
- ## Code scaffolding
21
-
22
- Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
23
-
24
- ## Build
25
-
26
- Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
27
-
28
- ## Running unit tests
29
-
30
- Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
31
-
32
- ## Running end-to-end tests
33
-
34
- Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
35
-
36
- ## Further help
37
-
38
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
1
+
2
+ # ApiAngularAcademiaI18n
3
+
4
+ This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.7.3.
5
+
6
+ ## Install CopyFiles Dependency
7
+
8
+ Install this dependencies to build the project correctly.
9
+
10
+ `npm install copyfiles -g`
11
+
12
+ `npm i gulp-merge-json`
13
+
14
+ `npm install gulp-jsonminify --save-dev`
15
+
16
+ ## Development server
17
+
18
+ Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
19
+
20
+ ## Code scaffolding
21
+
22
+ Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
23
+
24
+ ## Build
25
+
26
+ Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
27
+
28
+ ## Running unit tests
29
+
30
+ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
31
+
32
+ ## Running end-to-end tests
33
+
34
+ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
35
+
36
+ ## Further help
37
+
38
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
@@ -1,14 +1,14 @@
1
- import { TranslateService } from '@ngx-translate/core';
2
- import { AppService } from './app.service';
3
- export declare class I18NComponent {
4
- private utilTranslate;
5
- private appService;
6
- currentLang: string;
7
- flag: string;
8
- langs: any[];
9
- constructor(utilTranslate: TranslateService, appService: AppService);
10
- ngOnInit(): void;
11
- changeLanguage(): void;
12
- setFlag(flag: string): void;
13
- private setLanguage();
14
- }
1
+ import { TranslateService } from '@ngx-translate/core';
2
+ import { AppService } from './app.service';
3
+ export declare class I18NComponent {
4
+ private utilTranslate;
5
+ private appService;
6
+ currentLang: string;
7
+ flag: string;
8
+ langs: any[];
9
+ constructor(utilTranslate: TranslateService, appService: AppService);
10
+ ngOnInit(): void;
11
+ changeLanguage(): void;
12
+ setFlag(flag: string): void;
13
+ private setLanguage();
14
+ }
@@ -1,56 +1,56 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var core_1 = require("@angular/core");
4
- var core_2 = require("@ngx-translate/core");
5
- var api_1 = require("api-angular-academia-dto/api");
6
- var app_service_1 = require("./app.service");
7
- var I18NComponent = /** @class */ (function () {
8
- function I18NComponent(utilTranslate, appService) {
9
- var _this = this;
10
- this.utilTranslate = utilTranslate;
11
- this.appService = appService;
12
- this.langs = [];
13
- api_1.Languages.getAllEnumValues().forEach(function (element) {
14
- _this.langs.push(element.nameid);
15
- });
16
- this.utilTranslate.addLangs(this.langs);
17
- this.utilTranslate.setDefaultLang(api_1.Languages.SPANISH.nameid);
18
- var browserLang = this.utilTranslate.getBrowserLang(); //Get Browser Language
19
- this.utilTranslate.use(browserLang.match(/en|es/) ? browserLang : api_1.Languages.ENGLISH.nameid);
20
- this.currentLang = (browserLang.match(/en|es/) ? browserLang : api_1.Languages.ENGLISH.nameid);
21
- this.appService.saveCurrentLanguageInLS(this.currentLang);
22
- this.appService.currentLangChanges.subscribe(function (currentLang) {
23
- _this.currentLang = currentLang;
24
- _this.setLanguage();
25
- });
26
- }
27
- I18NComponent.prototype.ngOnInit = function () {
28
- this.setFlag(this.currentLang);
29
- };
30
- I18NComponent.prototype.changeLanguage = function () {
31
- this.setLanguage();
32
- this.appService.saveCurrentLanguageInLS(this.currentLang);
33
- };
34
- I18NComponent.prototype.setFlag = function (flag) {
35
- flag === api_1.Languages.SPANISH.nameid ? this.flag = api_1.Languages.ENGLISH.nameid : this.flag = api_1.Languages.SPANISH.nameid;
36
- };
37
- I18NComponent.prototype.setLanguage = function () {
38
- this.utilTranslate.use(this.currentLang);
39
- this.setFlag(this.currentLang);
40
- };
41
- I18NComponent.decorators = [
42
- { type: core_1.Component, args: [{
43
- selector: 'app-i18n',
44
- template: "\n <select id=\"languagescombobox1\" class=\"combobox\" [(ngModel)]=\"currentLang\" (change)=\"changeLanguage()\">\n <option *ngFor=\"let element of langs\" [ngValue]=\"element\">{{ element | translate }}</option>\n </select>\n ",
45
- styles: ["\n .combobox {\n margin: 0px;\n width: 100%;\n background-color: black;\n color: white;\n border: 1px solid white;\n padding: 2px;\n font-size: 12px;\n }\n "]
46
- },] },
47
- ];
48
- /** @nocollapse */
49
- I18NComponent.ctorParameters = function () { return [
50
- { type: core_2.TranslateService, },
51
- { type: app_service_1.AppService, },
52
- ]; };
53
- return I18NComponent;
54
- }());
55
- exports.I18NComponent = I18NComponent;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var core_1 = require("@angular/core");
4
+ var core_2 = require("@ngx-translate/core");
5
+ var api_1 = require("api-angular-academia-dto/api");
6
+ var app_service_1 = require("./app.service");
7
+ var I18NComponent = /** @class */ (function () {
8
+ function I18NComponent(utilTranslate, appService) {
9
+ var _this = this;
10
+ this.utilTranslate = utilTranslate;
11
+ this.appService = appService;
12
+ this.langs = [];
13
+ api_1.Languages.getAllEnumValues().forEach(function (element) {
14
+ _this.langs.push(element.nameid);
15
+ });
16
+ this.utilTranslate.addLangs(this.langs);
17
+ this.utilTranslate.setDefaultLang(api_1.Languages.SPANISH.nameid);
18
+ var browserLang = this.utilTranslate.getBrowserLang(); //Get Browser Language
19
+ this.utilTranslate.use(browserLang.match(/en|es/) ? browserLang : api_1.Languages.ENGLISH.nameid);
20
+ this.currentLang = (browserLang.match(/en|es/) ? browserLang : api_1.Languages.ENGLISH.nameid);
21
+ this.appService.saveCurrentLanguageInLS(this.currentLang);
22
+ this.appService.currentLangChanges.subscribe(function (currentLang) {
23
+ _this.currentLang = currentLang;
24
+ _this.setLanguage();
25
+ });
26
+ }
27
+ I18NComponent.prototype.ngOnInit = function () {
28
+ this.setFlag(this.currentLang);
29
+ };
30
+ I18NComponent.prototype.changeLanguage = function () {
31
+ this.setLanguage();
32
+ this.appService.saveCurrentLanguageInLS(this.currentLang);
33
+ };
34
+ I18NComponent.prototype.setFlag = function (flag) {
35
+ flag === api_1.Languages.SPANISH.nameid ? this.flag = api_1.Languages.ENGLISH.nameid : this.flag = api_1.Languages.SPANISH.nameid;
36
+ };
37
+ I18NComponent.prototype.setLanguage = function () {
38
+ this.utilTranslate.use(this.currentLang);
39
+ this.setFlag(this.currentLang);
40
+ };
41
+ I18NComponent.decorators = [
42
+ { type: core_1.Component, args: [{
43
+ selector: 'app-i18n',
44
+ template: "\n <select id=\"languagescombobox1\" class=\"combobox\" [(ngModel)]=\"currentLang\" (change)=\"changeLanguage()\">\n <option *ngFor=\"let element of langs\" [ngValue]=\"element\">{{ element | translate }}</option>\n </select>\n ",
45
+ styles: ["\n .combobox {\n margin: 0px;\n width: 100%;\n background-color: black;\n color: white;\n border: 1px solid white;\n padding: 2px;\n font-size: 12px;\n }\n "]
46
+ },] },
47
+ ];
48
+ /** @nocollapse */
49
+ I18NComponent.ctorParameters = function () { return [
50
+ { type: core_2.TranslateService, },
51
+ { type: app_service_1.AppService, },
52
+ ]; };
53
+ return I18NComponent;
54
+ }());
55
+ exports.I18NComponent = I18NComponent;
56
56
  //# sourceMappingURL=app.component.js.map
@@ -1,5 +1,5 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import { TranslateHttpLoader } from '@ngx-translate/http-loader';
3
- export declare function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader;
4
- export declare class I18NModule {
5
- }
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
3
+ export declare function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader;
4
+ export declare class I18NModule {
5
+ }
package/lib/app.module.js CHANGED
@@ -1,43 +1,43 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var platform_browser_1 = require("@angular/platform-browser");
4
- var core_1 = require("@angular/core");
5
- var app_component_1 = require("./app.component");
6
- var http_1 = require("@angular/common/http");
7
- var core_2 = require("@ngx-translate/core");
8
- var http_loader_1 = require("@ngx-translate/http-loader");
9
- var forms_1 = require("@angular/forms");
10
- var app_service_1 = require("./app.service");
11
- function HttpLoaderFactory(http) {
12
- return new http_loader_1.TranslateHttpLoader(http, './i18n/', '.json');
13
- }
14
- exports.HttpLoaderFactory = HttpLoaderFactory;
15
- var I18NModule = /** @class */ (function () {
16
- function I18NModule() {
17
- }
18
- I18NModule.decorators = [
19
- { type: core_1.NgModule, args: [{
20
- declarations: [
21
- app_component_1.I18NComponent
22
- ],
23
- imports: [
24
- platform_browser_1.BrowserModule,
25
- http_1.HttpClientModule,
26
- forms_1.FormsModule,
27
- core_2.TranslateModule.forRoot({
28
- loader: {
29
- provide: core_2.TranslateLoader,
30
- useFactory: HttpLoaderFactory,
31
- deps: [http_1.HttpClient]
32
- }
33
- })
34
- ],
35
- providers: [app_service_1.AppService],
36
- bootstrap: [app_component_1.I18NComponent],
37
- exports: [core_2.TranslateModule, app_component_1.I18NComponent]
38
- },] },
39
- ];
40
- return I18NModule;
41
- }());
42
- exports.I18NModule = I18NModule;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var platform_browser_1 = require("@angular/platform-browser");
4
+ var core_1 = require("@angular/core");
5
+ var app_component_1 = require("./app.component");
6
+ var http_1 = require("@angular/common/http");
7
+ var core_2 = require("@ngx-translate/core");
8
+ var http_loader_1 = require("@ngx-translate/http-loader");
9
+ var forms_1 = require("@angular/forms");
10
+ var app_service_1 = require("./app.service");
11
+ function HttpLoaderFactory(http) {
12
+ return new http_loader_1.TranslateHttpLoader(http, './i18n/', '.json');
13
+ }
14
+ exports.HttpLoaderFactory = HttpLoaderFactory;
15
+ var I18NModule = /** @class */ (function () {
16
+ function I18NModule() {
17
+ }
18
+ I18NModule.decorators = [
19
+ { type: core_1.NgModule, args: [{
20
+ declarations: [
21
+ app_component_1.I18NComponent
22
+ ],
23
+ imports: [
24
+ platform_browser_1.BrowserModule,
25
+ http_1.HttpClientModule,
26
+ forms_1.FormsModule,
27
+ core_2.TranslateModule.forRoot({
28
+ loader: {
29
+ provide: core_2.TranslateLoader,
30
+ useFactory: HttpLoaderFactory,
31
+ deps: [http_1.HttpClient]
32
+ }
33
+ })
34
+ ],
35
+ providers: [app_service_1.AppService],
36
+ bootstrap: [app_component_1.I18NComponent],
37
+ exports: [core_2.TranslateModule, app_component_1.I18NComponent]
38
+ },] },
39
+ ];
40
+ return I18NModule;
41
+ }());
42
+ exports.I18NModule = I18NModule;
43
43
  //# sourceMappingURL=app.module.js.map
@@ -1,12 +1,12 @@
1
- import { Observable } from 'rxjs/Observable';
2
- import 'rxjs/add/operator/share';
3
- export declare class AppService {
4
- private onSubject;
5
- currentLangChanges: Observable<any>;
6
- constructor();
7
- ngOnDestroy(): void;
8
- saveCurrentLanguageInLS(currentLanguage: any): void;
9
- private initializeListening();
10
- private storageLangEventListener(event);
11
- private stop();
12
- }
1
+ import { Observable } from 'rxjs/Observable';
2
+ import 'rxjs/add/operator/share';
3
+ export declare class AppService {
4
+ private onSubject;
5
+ currentLangChanges: Observable<any>;
6
+ constructor();
7
+ ngOnDestroy(): void;
8
+ saveCurrentLanguageInLS(currentLanguage: any): void;
9
+ private initializeListening();
10
+ private storageLangEventListener(event);
11
+ private stop();
12
+ }
@@ -1,47 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var core_1 = require("@angular/core");
4
- var Subject_1 = require("rxjs/Subject");
5
- require("rxjs/add/operator/share");
6
- var CURRENTLANGUAGEKEY = 'currentLanguage';
7
- var AppService = /** @class */ (function () {
8
- function AppService() {
9
- this.onSubject = new Subject_1.Subject();
10
- this.currentLangChanges = this.onSubject.asObservable().share();
11
- this.initializeListening();
12
- }
13
- AppService.prototype.ngOnDestroy = function () {
14
- this.stop();
15
- };
16
- AppService.prototype.saveCurrentLanguageInLS = function (currentLanguage) {
17
- localStorage.setItem(CURRENTLANGUAGEKEY, JSON.stringify(currentLanguage));
18
- this.onSubject.next(currentLanguage);
19
- };
20
- AppService.prototype.initializeListening = function () {
21
- window.addEventListener('storage', this.storageLangEventListener.bind(this));
22
- };
23
- AppService.prototype.storageLangEventListener = function (event) {
24
- if (event.storageArea.getItem('currentLanguage') == localStorage.getItem(CURRENTLANGUAGEKEY)) {
25
- var newLanguage = void 0;
26
- try {
27
- newLanguage = JSON.parse(event.newValue);
28
- }
29
- catch (e) {
30
- newLanguage = event.newValue;
31
- }
32
- this.onSubject.next(newLanguage);
33
- }
34
- };
35
- AppService.prototype.stop = function () {
36
- window.removeEventListener("storage", this.storageLangEventListener.bind(this));
37
- this.onSubject.complete();
38
- };
39
- AppService.decorators = [
40
- { type: core_1.Injectable },
41
- ];
42
- /** @nocollapse */
43
- AppService.ctorParameters = function () { return []; };
44
- return AppService;
45
- }());
46
- exports.AppService = AppService;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var core_1 = require("@angular/core");
4
+ var Subject_1 = require("rxjs/Subject");
5
+ require("rxjs/add/operator/share");
6
+ var CURRENTLANGUAGEKEY = 'currentLanguage';
7
+ var AppService = /** @class */ (function () {
8
+ function AppService() {
9
+ this.onSubject = new Subject_1.Subject();
10
+ this.currentLangChanges = this.onSubject.asObservable().share();
11
+ this.initializeListening();
12
+ }
13
+ AppService.prototype.ngOnDestroy = function () {
14
+ this.stop();
15
+ };
16
+ AppService.prototype.saveCurrentLanguageInLS = function (currentLanguage) {
17
+ localStorage.setItem(CURRENTLANGUAGEKEY, JSON.stringify(currentLanguage));
18
+ this.onSubject.next(currentLanguage);
19
+ };
20
+ AppService.prototype.initializeListening = function () {
21
+ window.addEventListener('storage', this.storageLangEventListener.bind(this));
22
+ };
23
+ AppService.prototype.storageLangEventListener = function (event) {
24
+ if (event.storageArea.getItem('currentLanguage') == localStorage.getItem(CURRENTLANGUAGEKEY)) {
25
+ var newLanguage = void 0;
26
+ try {
27
+ newLanguage = JSON.parse(event.newValue);
28
+ }
29
+ catch (e) {
30
+ newLanguage = event.newValue;
31
+ }
32
+ this.onSubject.next(newLanguage);
33
+ }
34
+ };
35
+ AppService.prototype.stop = function () {
36
+ window.removeEventListener("storage", this.storageLangEventListener.bind(this));
37
+ this.onSubject.complete();
38
+ };
39
+ AppService.decorators = [
40
+ { type: core_1.Injectable },
41
+ ];
42
+ /** @nocollapse */
43
+ AppService.ctorParameters = function () { return []; };
44
+ return AppService;
45
+ }());
46
+ exports.AppService = AppService;
47
47
  //# sourceMappingURL=app.service.js.map
@@ -1 +1 @@
1
- export * from './app.module';
1
+ export * from './app.module';
@@ -1,7 +1,7 @@
1
- "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- __export(require("./app.module"));
1
+ "use strict";
2
+ function __export(m) {
3
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
+ }
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ __export(require("./app.module"));
7
7
  //# sourceMappingURL=exportedModules.js.map