@criticalmanufacturing/dev-i18n-transform
Version:
i18n <--> gettext transform
49 lines (48 loc) • 1.35 kB
TypeScript
import { Translation } from "./translation";
export declare class Message {
/**
* Gets the Message Id
*/
readonly id: string;
/**
* Gets the Description
*/
readonly description: string;
/**
* Message translations
*/
private readonly _translations;
/**
* Message constructor
*
* @param id Message id
* @param description Message description
*/
constructor(id: string, description?: string);
/**
* Add or update a translation to the message
*
* @param translation Translation to add (or update) to the message
*/
addOrUpdateTranslation(translation: Translation): void;
/**
* Check if the given translation exists
* @param code Language code
* @return True if the translation exists, false otherwise
*/
hasTranslation(code: string): boolean;
/**
* Gets the translation for the given code
*
* @param code Language code
* @returns {@see Translation} if exists, null otherwise
*/
getTranslation(code: string): Translation;
/**
* Merge the given message into the current.
* Adds or updates the base translations with the new ones.
*
* @param message Message to merge
*/
merge(message: Message): void;
}