diff --git a/decls/i18n.js b/decls/i18n.js index b192da890..e7c934e16 100644 --- a/decls/i18n.js +++ b/decls/i18n.js @@ -100,6 +100,7 @@ declare type I18nOptions = { postTranslation?: PostTranslationHandler, componentInstanceCreatedListener?: ComponentInstanceCreatedListener, escapeParameterHtml?: boolean, + __VUE_I18N_BRIDGE__?: string, }; declare type IntlAvailability = { diff --git a/src/index.js b/src/index.js index 559c7cfd6..e0c539101 100644 --- a/src/index.js +++ b/src/index.js @@ -63,6 +63,7 @@ export default class VueI18n { _warnHtmlInMessage: WarnHtmlInMessageLevel _escapeParameterHtml: boolean _postTranslation: ?PostTranslationHandler + __VUE_I18N_BRIDGE__: ?string pluralizationRules: { [lang: string]: (choice: number, choicesLength: number) => number } @@ -116,6 +117,10 @@ export default class VueI18n { this._postTranslation = options.postTranslation || null this._escapeParameterHtml = options.escapeParameterHtml || false + if ('__VUE_I18N_BRIDGE__' in options) { + this.__VUE_I18N_BRIDGE__ = options.__VUE_I18N_BRIDGE__ + } + /** * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)` * @param choicesLength {number} an overall amount of available choices