Merge pull request #137 from element-hq/dbkr/human_eyes
Add humanizeTime to the module i18n API
This commit is contained in:
@@ -173,6 +173,7 @@ export interface ExtrasApi {
|
|||||||
|
|
||||||
// @public
|
// @public
|
||||||
export interface I18nApi {
|
export interface I18nApi {
|
||||||
|
humanizeTime(timeMillis: number): string;
|
||||||
get language(): string;
|
get language(): string;
|
||||||
register(translations: Partial<Translations>): void;
|
register(translations: Partial<Translations>): void;
|
||||||
translate(key: keyof Translations, variables?: Variables): string;
|
translate(key: keyof Translations, variables?: Variables): string;
|
||||||
|
|||||||
@@ -49,4 +49,11 @@ export interface I18nApi {
|
|||||||
* @param variables - Optional variables to interpolate into the translation
|
* @param variables - Optional variables to interpolate into the translation
|
||||||
*/
|
*/
|
||||||
translate(key: keyof Translations, variables?: Variables): string;
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user