Merge pull request #4379 from tsiegleauq/translate-user-number

Add "No." as translateable
This commit is contained in:
Emanuel Schütze 2019-02-21 08:56:41 +01:00 committed by GitHub
commit 68667f904f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 6 deletions

View File

@ -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",

View File

@ -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

View File

@ -56,6 +56,10 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
viewUser.getVerboseName = (plural: boolean = false) => {
return this.translate.instant(plural ? 'Participants' : 'Participant');
};
viewUser.getNumberForName = (nr: number) => {
return `${this.translate.instant('No.')} ${nr}`;
};
return viewUser;
}

View File

@ -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;