diff --git a/scripts/langindex.json b/scripts/langindex.json index 2e339fcb0..53803707e 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1156,6 +1156,7 @@ "core.accounts": "admin", "core.add": "moodle", "core.agelocationverification": "moodle", + "core.ago": "message", "core.all": "moodle", "core.allparticipants": "moodle", "core.android": "local_moodlemobileapp", diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index 6c3410e73..7ec923ad5 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -1156,6 +1156,7 @@ "core.accounts": "Accounts", "core.add": "Add", "core.agelocationverification": "Age and location verification", + "core.ago": "{{$a}} ago", "core.all": "All", "core.allparticipants": "All participants", "core.android": "Android", diff --git a/src/lang/en.json b/src/lang/en.json index 317c08547..dc10e000f 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -2,6 +2,7 @@ "accounts": "Accounts", "add": "Add", "agelocationverification": "Age and location verification", + "ago": "{{$a}} ago", "all": "All", "allparticipants": "All participants", "android": "Android", diff --git a/src/pipes/time-ago.ts b/src/pipes/time-ago.ts index 07f8d3dd6..bef10d8f0 100644 --- a/src/pipes/time-ago.ts +++ b/src/pipes/time-ago.ts @@ -13,6 +13,7 @@ // limitations under the License. import { Pipe, PipeTransform } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; import { CoreLoggerProvider } from '@providers/logger'; import * as moment from 'moment'; @@ -25,7 +26,7 @@ import * as moment from 'moment'; export class CoreTimeAgoPipe implements PipeTransform { protected logger; - constructor(logger: CoreLoggerProvider) { + constructor(logger: CoreLoggerProvider, private translate: TranslateService) { this.logger = logger.getInstance('CoreTimeAgoPipe'); } @@ -47,6 +48,6 @@ export class CoreTimeAgoPipe implements PipeTransform { timestamp = numberTimestamp; } - return moment(timestamp * 1000).fromNow(true); + return this.translate.instant('core.ago', {$a: moment(timestamp * 1000).fromNow(true)}); } }