Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADMIN: Fix translation #166

Merged
merged 1 commit into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions ui/admin/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"with": "src/environments/environment.prod.ts"
}
],
"aot": false,
"i18nLocale": "fr"
"aot": false
},
"production": {
"fileReplacements": [
Expand All @@ -70,7 +69,6 @@
"maximumError": "5mb"
}
],
"i18nLocale": "en",
"deployUrl": "/static/js/rero_ils/admin/",
"outputPath": "../../rero_ils/static/js/rero_ils/admin"
}
Expand All @@ -91,10 +89,6 @@
},
"fr": {
"browserTarget": "admin:build:fr"
},
"proxy": {
"browserTarget": "admin:build:proxy",
"proxyConfig": "proxy.conf.json"
}
}
},
Expand Down
18 changes: 13 additions & 5 deletions ui/admin/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BrowserModule } from '@angular/platform-browser';
import { registerLocaleData } from '@angular/common';
import { NgModule, LOCALE_ID } from '@angular/core';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { BsLocaleService } from 'ngx-bootstrap/datepicker';
Expand All @@ -9,12 +10,18 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { environment } from '../environments/environment';
import { defineLocale } from 'ngx-bootstrap/chronos';
import { deLocale, enGbLocale, frLocale, itLocale } from 'ngx-bootstrap/locale';
import localeDe from '@angular/common/locales/de';
import localeEn from '@angular/common/locales/en';
import localeFr from '@angular/common/locales/fr';
import localeIt from '@angular/common/locales/it';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

import { MylibraryComponent } from './mylibrary/mylibrary.component';
import { UserService } from './user.service';



export function HttpLoaderFactory(http: HttpClient) {
let assets_prefix = '/';
if (environment.production) {
Expand Down Expand Up @@ -64,10 +71,10 @@ export function HttpLoaderFactory(http: HttpClient) {
})
export class AppModule {
languages = {
'de': deLocale,
'en': enGbLocale,
'fr': frLocale,
'it': itLocale
'de': { ngx: deLocale, angular: localeDe },
'en': { ngx: enGbLocale, angular: localeEn },
'fr': { ngx: frLocale, angular: localeFr },
'it': { ngx: itLocale, angular: localeIt }
};

constructor(
Expand All @@ -76,7 +83,8 @@ export class AppModule {
) {
translate.setDefaultLang('en');
for (const [key, value] of Object.entries(this.languages)) {
defineLocale(key, value);
defineLocale(key, value.ngx);
registerLocaleData(value.angular, key);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, Input, Inject, LOCALE_ID } from '@angular/core';
import { Component, OnInit, Input } from '@angular/core';
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
import { ExceptionDatesEditComponent } from '../exception-dates-edit/exception-dates-edit.component';

Expand All @@ -13,10 +13,7 @@ export class ExceptionDatesListComponent implements OnInit {

@Input() library;

constructor(
private modalService: BsModalService,
@Inject(LOCALE_ID) locale: string
) { }
constructor(private modalService: BsModalService) { }

ngOnInit() {
}
Expand Down