diff --git a/client/package.json b/client/package.json index 185c9e493..bf6f1d717 100644 --- a/client/package.json +++ b/client/package.json @@ -62,6 +62,7 @@ "@angular/cli": "^7.3.2", "@angular/compiler-cli": "^7.2.5", "@angular/language-service": "^7.2.5", + "@biesbjerg/ngx-translate-extract": "^2.3.4", "@compodoc/compodoc": "^1.1.8", "@types/jasmine": "^3.3.9", "@types/jasminewd2": "^2.0.6", diff --git a/client/src/app/core/marked-translations.ts b/client/src/app/core/marked-translations.ts index 218a59128..38c826255 100644 --- a/client/src/app/core/marked-translations.ts +++ b/client/src/app/core/marked-translations.ts @@ -1,8 +1,9 @@ -// import { _ } from '@biesbjerg/ngx-translate-extract'; +import { _ } from '@biesbjerg/ngx-translate-extract'; -function _(key: string | string[]): string | string[] { - return key; -} +// see issue: 4078 +// function _(key: string | string[]): string | string[] { +// return key; +// } /** * Add strings here that require translations but have never been declared diff --git a/client/src/app/core/repositories/users/user-repository.service.ts b/client/src/app/core/repositories/users/user-repository.service.ts index 1bff35684..6fac019eb 100644 --- a/client/src/app/core/repositories/users/user-repository.service.ts +++ b/client/src/app/core/repositories/users/user-repository.service.ts @@ -56,6 +56,10 @@ export class UserRepositoryService extends BaseRepository { viewUser.getVerboseName = (plural: boolean = false) => { return this.translate.instant(plural ? 'Participants' : 'Participant'); }; + + viewUser.getNumberForName = (nr: number) => { + return `${this.translate.instant('No.')} ${nr}`; + }; return viewUser; } diff --git a/client/src/app/site/users/models/view-user.ts b/client/src/app/site/users/models/view-user.ts index 7915cb6e4..f99a7d1ab 100644 --- a/client/src/app/site/users/models/view-user.ts +++ b/client/src/app/site/users/models/view-user.ts @@ -152,8 +152,7 @@ export class ViewUser extends BaseProjectableViewModel implements Searchable { const number = this.number ? this.number.trim() : ''; if (number) { - // TODO Translate - additions.push('No. ' + number); + additions.push(this.getNumberForName(number)); } if (additions.length > 0) { @@ -167,6 +166,11 @@ export class ViewUser extends BaseProjectableViewModel implements Searchable { */ public getVerboseName; + /** + * This is set by the repository. Translates the number string. + */ + public getNumberForName; + public constructor(user: User, groups?: ViewGroup[]) { super(User.COLLECTIONSTRING); this._user = user;