Skip to content

Commit

Permalink
Updated events
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Jun 7, 2016
1 parent ae2ad71 commit f39c92b
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions src/services/locale.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,13 @@ import {Injectable, EventEmitter, Output} from '@angular/core';
// Checks if the language has changed.
if (this.languageCode != language) {

// Assigns the value & sends an event.
this.languageCode = language;
this.languageCodeChanged.emit(language);

// Sets the default locale.
this.setDefaultLocale();

// Sends an event.
this.languageCodeChanged.emit(language);

}

}
Expand All @@ -440,14 +439,13 @@ import {Injectable, EventEmitter, Output} from '@angular/core';
// Checks if the country has changed.
if (this.countryCode != country) {

// Assigns the value & sends an event.
this.countryCode = country;
this.countryCodeChanged.emit(country);

// Sets the default locale.
this.setDefaultLocale();

// Sends an event.
this.countryCodeChanged.emit(country);

}

}
Expand All @@ -466,22 +464,16 @@ import {Injectable, EventEmitter, Output} from '@angular/core';
// Checks if language, country, script or extension have changed.
if (this.languageCode != language || this.countryCode != country || this.scriptCode != script || this.numberingSystem != numberingSystem || this.calendar != calendar) {

this.languageCode = language;
this.countryCode = country;
this.scriptCode = script;
this.numberingSystem = numberingSystem;
this.calendar = calendar;
// Assigns the values & sends the events.
if (this.languageCode != language) { this.languageCode = language; this.languageCodeChanged.emit(language); }
if (this.countryCode != country) { this.countryCode = country; this.countryCodeChanged.emit(country); }
if (this.scriptCode != script) { this.scriptCode = script; this.scriptCodeChanged.emit(script); }
if (this.numberingSystem != numberingSystem) { this.numberingSystem = numberingSystem; this.numberingSystemChanged.emit(numberingSystem); }
if (this.calendar != calendar) { this.calendar = calendar; this.calendarChanged.emit(calendar); }

// Sets the default locale.
this.setDefaultLocale();

// Sends the events.
this.languageCodeChanged.emit(language);
this.countryCodeChanged.emit(country);
this.scriptCodeChanged.emit(script);
this.numberingSystemChanged.emit(numberingSystem);
this.calendarChanged.emit(calendar);

}

}
Expand All @@ -496,7 +488,9 @@ import {Injectable, EventEmitter, Output} from '@angular/core';
// Checks if the currency has changed.
if (this.currencyCode != currency) {

// Assigns the value & sends an event.
this.currencyCode = currency;
this.currencyCodeChanged.emit(currency);

// Sets the cookie "currency".
if (this.enableCookie == true && this.languageCodes.length > 0) {
Expand All @@ -505,9 +499,6 @@ import {Injectable, EventEmitter, Output} from '@angular/core';

}

// Sends an event.
this.currencyCodeChanged.emit(currency);

}

}
Expand Down

0 comments on commit f39c92b

Please sign in to comment.