@atrysglobal/babel-ripper
Version:
Interface and strict typing toolkit for accessing the BABEL unified translation service.
61 lines (60 loc) • 1.88 kB
TypeScript
import { BabelMessagingResult, BabelTargetInterface } from '../babel-proxy';
export declare class BabelRipper {
translations: BabelMessagingResult[];
constructor(translations: BabelMessagingResult[]);
/**
* Returns the translation result for a given
* translation reference.
*
* @param {string} input - Translation reference.
* @returns {string} - Translation result.
*
* @example
*
* const dictionary = {
* hello: 'messages.hello',
* bye: 'messages.bye'
* }
*
* const babel = new BabelProxyService(...);
* const result = await babel.loadGuttedTranslations(dictionary);
*
* result.get(dictionary.hello); // Hola!
* result.get(dictionary.bye); // Adiós!
*
*/
get(input: string | BabelTargetInterface): string;
/**
* Returns the translation result for a given
* translation reference.
*
* @deprecated This function will be deprecated in future versions. Please use the `get` function instead.
*
* @param {string} input - Translation reference.
* @returns {string} - Translation result.
*
* @example
*
* const dictionary = {
* hello: 'messages.hello',
* bye: 'messages.bye'
* }
*
* const babel = new BabelProxyService(...);
* const result = await babel.loadGuttedTranslations(dictionary);
*
* result.getTranslation(dictionary.hello); // Hola!
* result.getTranslation(dictionary.bye); // Adiós!
*
*/
getTranslation(input: string | BabelTargetInterface): string;
/**
* Returns the translation identifier for a given
* translation message.
*
* @param {string} input - Translation message.
* @returns {string} - Translation identifier.
*
*/
getIdentifier(input: string | BabelMessagingResult): string;
}