Fixed some translation issues
This commit is contained in:
parent
5c9bf97ab9
commit
303f33f772
@ -8,7 +8,6 @@ import { BaseScreenComponent } from '@components/base-screen/base-screen.compone
|
||||
import { ApiModule, GeneralSettingsControllerService } from '@redaction/red-ui-http';
|
||||
import { ApiPathInterceptor } from '@utils/api-path-interceptor';
|
||||
import { MissingTranslationHandler, TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
import { languageInitializer } from '@i18n/language.initializer';
|
||||
import { LanguageService } from '@i18n/language.service';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
@ -34,9 +33,10 @@ import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-comp
|
||||
import { configurationInitializer } from '@app-config/configuration.initializer';
|
||||
import { AppConfigService } from '@app-config/app-config.service';
|
||||
import { SpotlightSearchComponent } from '@components/spotlight-search/spotlight-search.component';
|
||||
import { PruningTranslationLoader } from '@utils/pruning-translation-loader';
|
||||
|
||||
export function httpLoaderFactory(httpClient: HttpClient) {
|
||||
return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json');
|
||||
return new PruningTranslationLoader(httpClient, '/assets/i18n/', '.json');
|
||||
}
|
||||
|
||||
function cleanupBaseUrl(baseUrl: string) {
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
import { ChangeDetectionStrategy, Component, Inject, Input, OnDestroy } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, Input, OnDestroy } from '@angular/core';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { DossierWrapper } from '@state/model/dossier.wrapper';
|
||||
import { FileStatusWrapper } from '@models/file/file-status.wrapper';
|
||||
import { FileDownloadService } from '@upload-download/services/file-download.service';
|
||||
import { Toaster } from '@services/toaster.service';
|
||||
import { BASE_HREF } from '../../../../../tokens';
|
||||
import { AutoUnsubscribeComponent } from '@shared/base/auto-unsubscribe.component';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
@ -26,7 +25,6 @@ export class FileDownloadBtnComponent extends AutoUnsubscribeComponent implement
|
||||
@Input() disabled = false;
|
||||
|
||||
constructor(
|
||||
@Inject(BASE_HREF) private readonly _baseHref: string,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _fileDownloadService: FileDownloadService,
|
||||
private readonly _toaster: Toaster,
|
||||
@ -54,7 +52,7 @@ export class FileDownloadBtnComponent extends AutoUnsubscribeComponent implement
|
||||
this.addSubscription = this._fileDownloadService
|
||||
.downloadFiles(Array.isArray(this.file) ? this.file : [this.file], this.dossier)
|
||||
.subscribe(() => {
|
||||
this._toaster.info(_('download-status.queued'), { params: { baseUrl: this._baseHref } });
|
||||
this._toaster.info(_('download-status.queued'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ import { MissingTranslationHandler, MissingTranslationHandlerParams } from '@ngx
|
||||
export class REDMissingTranslationHandler implements MissingTranslationHandler {
|
||||
handle(params: MissingTranslationHandlerParams): any {
|
||||
const missingKey = params.key;
|
||||
console.error('Missing translation: ' + missingKey);
|
||||
return missingKey;
|
||||
// console.error('Missing translation: ' + missingKey);
|
||||
return `?${missingKey}?`;
|
||||
}
|
||||
}
|
||||
|
||||
23
apps/red-ui/src/app/utils/pruning-translation-loader.ts
Normal file
23
apps/red-ui/src/app/utils/pruning-translation-loader.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { TranslateLoader } from '@ngx-translate/core';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
export class PruningTranslationLoader implements TranslateLoader {
|
||||
constructor(private _http: HttpClient, private _prefix: string, private _suffix: string) {}
|
||||
|
||||
getTranslation(lang: string): any {
|
||||
return this._http.get(`${this._prefix}${lang}${this._suffix}`).pipe(map((result: object) => this._process(result)));
|
||||
}
|
||||
|
||||
private _process(object: object) {
|
||||
return (
|
||||
Object.keys(object)
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
.filter(key => object.hasOwnProperty(key) && object[key] !== '')
|
||||
.reduce(
|
||||
(result, key) => ((result[key] = typeof object[key] === 'object' ? this._process(object[key]) : object[key]), result),
|
||||
{}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -712,7 +712,7 @@
|
||||
},
|
||||
"download-includes": "Choose what is included at download:",
|
||||
"download-status": {
|
||||
"queued": "Your download has been queued, you can see all your requested downloads here: <a href='{baseUrl}/main/downloads'>My Downloads <a/>."
|
||||
"queued": "Your download has been queued, you can see all your requested downloads here: <a href='/main/downloads'>My Downloads<a/>."
|
||||
},
|
||||
"download-type": {
|
||||
"annotated": "Annotated PDF",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user