Skip to content

Commit

Permalink
improvement: add flags for vue-i18n-bridge (#1390)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon authored Sep 28, 2021
1 parent 177def5 commit 31ac511
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions decls/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ declare type I18nOptions = {
postTranslation?: PostTranslationHandler,
componentInstanceCreatedListener?: ComponentInstanceCreatedListener,
escapeParameterHtml?: boolean,
__VUE_I18N_BRIDGE__?: string,
};

declare type IntlAvailability = {
Expand Down
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 31ac511

Please sign in to comment.