From 849f8f0acbe896cac7e531fee6895442382318cc Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Thu, 13 Apr 2017 09:24:37 +0000
Subject: [PATCH] #0 config - Migrated to jspm and Angular 4.0.2

---
 securis/src/main/webapp/src/app/common/i18n.ts |   44 ++++++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/securis/src/main/webapp/src/app/common/i18n.ts b/securis/src/main/webapp/src/app/common/i18n.ts
index 1d81d6f..0c9a87d 100644
--- a/securis/src/main/webapp/src/app/common/i18n.ts
+++ b/securis/src/main/webapp/src/app/common/i18n.ts
@@ -1,20 +1,10 @@
-import { Http } from '@angular/http';
-import { ModuleWithProviders, NgModule, Inject, Injectable, Directive, ElementRef, HostListener, Input, Renderer } from '@angular/core';
+import { Http, HttpModule } from '@angular/http';
+import { ModuleWithProviders, NgModule, Inject, TypeProvider, Injectable, Directive, ElementRef, Renderer } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
 declare var navigator:any;
 
-declare global {
-    interface String {
-        capitalize(): string;
-        cap(): string;
-    }
-}
-
-String.prototype.capitalize = function() {
-    return this[0].toUpperCase() + this.slice(1);
-}
-String.prototype.cap = String.prototype.capitalize; 
-
 // Use as reference: https://github.com/ngx-translate/core/tree/master/src
+
 @Injectable()
 export class LocaleService {
     get URL_TPL() {return  'src/lang/messages_{0}.json'};
@@ -23,7 +13,8 @@
 	private _currentLang : string = null;
     private _messages : any = null;
     private _elements = new Array<ElementRef>();
-    private constructor(private http: Http, @Inject('INITIAL_LANG') initLang: string) {
+    constructor(private http: Http, @Inject('INITIAL_LANG') initLang: string) {
+        var initLang = 'en';
 		this.lang = initLang || this.getBrowserLang();
     }
     
@@ -115,10 +106,8 @@
         if (params.length === 0) return trans_msg;
         return this._format(trans_msg, ...params);
     }
-
     
 }
-
 
 @Directive({ selector: '[i18n]' })
 export class I18nDirective {
@@ -134,15 +123,30 @@
     }
 }
 
+
+
+declare global {
+    interface String {
+        capitalize(): string;
+        cap(): string;
+    }
+}
+String.prototype.capitalize = function() {
+    return this[0].toUpperCase() + this.slice(1);
+}
+String.prototype.cap = String.prototype.capitalize; 
+
+
 @NgModule({
-    providers: [ <any>LocaleService ]
+    providers: [ ]
 })
 export class LocaleServiceModule {
     static withConfig(initLang?: string): ModuleWithProviders {
         return {
             ngModule: LocaleServiceModule,
-            providers: [
-                { provide: 'INITIAL_LANG', useValue: initLang }
+            providers: [ 
+                { provide: 'INITIAL_LANG', useValue: initLang },
+                LocaleService
             ]
         }
     }

--
Gitblit v1.3.2