"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/app/core/locale/locale.service.ts" between
dspace-angular-dspace-7.0.tar.gz and dspace-angular-dspace-7.1.tar.gz

About: dspace-angular is the Angular-based frontend of DSpace, a digital repository system to capture, store, index, preserve and redistribute an organization’s research material in digital formats.

locale.service.ts  (dspace-angular-dspace-7.0):locale.service.ts  (dspace-angular-dspace-7.1)
skipping to change at line 13 skipping to change at line 13
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { isEmpty, isNotEmpty } from '../../shared/empty.util'; import { isEmpty, isNotEmpty } from '../../shared/empty.util';
import { CookieService } from '../services/cookie.service'; import { CookieService } from '../services/cookie.service';
import { environment } from '../../../environments/environment'; import { environment } from '../../../environments/environment';
import { AuthService } from '../auth/auth.service'; import { AuthService } from '../auth/auth.service';
import { combineLatest, Observable, of as observableOf } from 'rxjs'; import { combineLatest, Observable, of as observableOf } from 'rxjs';
import { map, mergeMap, take } from 'rxjs/operators'; import { map, mergeMap, take } from 'rxjs/operators';
import { NativeWindowRef, NativeWindowService } from '../services/window.service '; import { NativeWindowRef, NativeWindowService } from '../services/window.service ';
import { RouteService } from '../services/route.service'; import { RouteService } from '../services/route.service';
import { DOCUMENT } from '@angular/common';
export const LANG_COOKIE = 'dsLanguage'; export const LANG_COOKIE = 'dsLanguage';
/** /**
* This enum defines the possible origin of the languages * This enum defines the possible origin of the languages
*/ */
export enum LANG_ORIGIN { export enum LANG_ORIGIN {
UI, UI,
EPERSON, EPERSON,
BROWSER BROWSER
skipping to change at line 41 skipping to change at line 42
/** /**
* Eperson language metadata * Eperson language metadata
*/ */
EPERSON_LANG_METADATA = 'eperson.language'; EPERSON_LANG_METADATA = 'eperson.language';
constructor( constructor(
@Inject(NativeWindowService) protected _window: NativeWindowRef, @Inject(NativeWindowService) protected _window: NativeWindowRef,
protected cookie: CookieService, protected cookie: CookieService,
protected translate: TranslateService, protected translate: TranslateService,
protected authService: AuthService, protected authService: AuthService,
protected routeService: RouteService) { protected routeService: RouteService,
@Inject(DOCUMENT) private document: any
) {
} }
/** /**
* Get the language currently used * Get the language currently used
* *
* @returns {string} The language code * @returns {string} The language code
*/ */
getCurrentLanguageCode(): string { getCurrentLanguageCode(): string {
// Attempt to get the language from a cookie // Attempt to get the language from a cookie
let lang = this.getLanguageCodeFromCookie(); let lang = this.getLanguageCodeFromCookie();
skipping to change at line 151 skipping to change at line 154
* *
* @param lang * @param lang
* The language to set, if it's not provided retrieve default one * The language to set, if it's not provided retrieve default one
*/ */
setCurrentLanguageCode(lang?: string): void { setCurrentLanguageCode(lang?: string): void {
if (isEmpty(lang)) { if (isEmpty(lang)) {
lang = this.getCurrentLanguageCode(); lang = this.getCurrentLanguageCode();
} }
this.translate.use(lang); this.translate.use(lang);
this.saveLanguageCodeToCookie(lang); this.saveLanguageCodeToCookie(lang);
this.document.documentElement.lang = lang;
} }
/** /**
* Set the quality factor for all element of input array. * Set the quality factor for all element of input array.
* Returns a new array that contains the languages list with the quality value . * Returns a new array that contains the languages list with the quality value .
* The quality factor indicate the relative degree of preference for the langu age * The quality factor indicate the relative degree of preference for the langu age
* @param languages the languages list * @param languages the languages list
* @param origin origin of language list (UI, EPERSON, BROWSER) * @param origin origin of language list (UI, EPERSON, BROWSER)
* @param hasOther true if contains other language, false otherwise * @param hasOther true if contains other language, false otherwise
*/ */
 End of changes. 3 change blocks. 
1 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)