Skip to content

Commit

Permalink
add key to postTranslation (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryuk committed Apr 19, 2020
1 parent 8b01832 commit 12f0b7d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion decls/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ declare type TranslateResult = string | LocaleMessages;
declare type DateTimeFormatResult = string;
declare type NumberFormatResult = string;
declare type MissingHandler = (locale: Locale, key: Path, vm?: any) => string | void;
declare type PostTranslationHandler = (str: string) => string;
declare type PostTranslationHandler = (str: string, key?: string) => string;

declare type FormattedNumberPartType = 'currency' | 'decimal' | 'fraction' | 'group' | 'infinity' | 'integer' | 'literal' | 'minusSign' | 'nan' | 'plusSign' | 'percentSign';
declare type FormattedNumberPart = {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ export default class VueI18n {
} else {
ret = this._warnDefault(locale, key, ret, host, values, 'string')
if (this._postTranslation && ret !== null && ret !== undefined) {
ret = this._postTranslation(ret)
ret = this._postTranslation(ret, key)
}
return ret
}
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ declare namespace VueI18n {
}

type MissingHandler = (locale: Locale, key: Path, vm: Vue | null, values: any) => string | void;
type PostTranslationHandler = (str: string) => string;
type PostTranslationHandler = (str: string, key?: string) => string;

interface IntlAvailability {
dateTimeFormat: boolean;
Expand Down

0 comments on commit 12f0b7d

Please sign in to comment.