Source

externalCode/translationsApi.js

/**
 * @typedef {string} LanguageLocale
 * @example
 * "en_US"
 * "de_DE"
 */

/**
 * @typedef {Object<LanguageLocale, {key: string}>} Translation
 * @example
 * "en_US" :{
 *	// Key                      value
 *	"common.failDefaultMessage": "Server request failed",
 * }
 */

/**
 * @typedef {Function} TransformTranslationCallback
 * @param {Translation}
 * @return {Translation}
 */

/**
 * @ignore
 * Reason for ignore: All functions are deprecated
 * @class
 * Translation Hooks.
 * Instance name: translationApi
 * @example
 * externalCodeSetup.translationApi.METHOD_NAME
 */
export class TranslationApi {
	customTranslations;

	/**
	 * Add custom translation
	 * @method
	 * @deprecated
	 * @param {Translation} translation
	 */
	addCustomTranslations = translation => {
		this.customTranslations.push(translation);
	};

	translationsFilter = translations => translations;

	/**
	 * Sets function capable of modifing existing translations
	 * @method
	 * @deprecated
	 * @param {TransformTranslationCallback} translationsFilter
	 */
	setTranslationsFilter = translationsFilter => {
		this.translationsFilter = translationsFilter;
	};
}