Merge pull request #137 from element-hq/dbkr/human_eyes

Add humanizeTime to the module i18n API
This commit is contained in:
David Baker 2025-12-01 09:08:51 +00:00 committed by GitHub
commit 0d69056e7b
2 changed files with 8 additions and 0 deletions

View File

@ -173,6 +173,7 @@ export interface ExtrasApi {
// @public
export interface I18nApi {
humanizeTime(timeMillis: number): string;
get language(): string;
register(translations: Partial<Translations>): void;
translate(key: keyof Translations, variables?: Variables): string;

View File

@ -49,4 +49,11 @@ export interface I18nApi {
* @param variables - Optional variables to interpolate into the translation
*/
translate(key: keyof Translations, variables?: Variables): string;
/**
* Convert a timestamp into a translated, human-readable time,
* using the current system time as a reference, eg. "5 minutes ago".
* @param timeMillis - The time in milliseconds since epoch
*/
humanizeTime(timeMillis: number): string;
}