@@ -3,7 +3,7 @@ import { OptionsInterface } from './interfaces/options'
33import { PluginOptionsInterface } from './interfaces/plugin-options'
44import { LanguageInterface } from './interfaces/language'
55import { LanguageJsonFileInterface } from './interfaces/language-json-file'
6- import { ReplacementsInterface } from './interfaces/replacements'
6+ import { Replacements } from './interfaces/replacements'
77import { choose } from './pluralization'
88import { avoidExceptionOnPromise , avoidException } from './utils/avoid-exceptions'
99import { hasPhpTranslations } from './utils/has-php-translations'
@@ -50,32 +50,28 @@ export function loadLanguageAsync(lang: string, dashLangTry = false): Promise<st
5050/**
5151 * Get the translation for the given key.
5252 */
53- export function trans ( key : string , replacements : ReplacementsInterface = { } ) : string {
53+ export function trans ( key : string , replacements : Replacements = { } ) : string {
5454 return I18n . getSharedInstance ( ) . trans ( key , replacements )
5555}
5656
5757/**
5858 * Get the translation for the given key and watch for any changes.
5959 */
60- export function wTrans ( key : string , replacements : ReplacementsInterface = { } ) : ComputedRef < string > {
60+ export function wTrans ( key : string , replacements : Replacements = { } ) : ComputedRef < string > {
6161 return I18n . getSharedInstance ( ) . wTrans ( key , replacements )
6262}
6363
6464/**
6565 * Translates the given message based on a count.
6666 */
67- export function transChoice ( key : string , number : number , replacements : ReplacementsInterface = { } ) : string {
67+ export function transChoice ( key : string , number : number , replacements : Replacements = { } ) : string {
6868 return I18n . getSharedInstance ( ) . transChoice ( key , number , replacements )
6969}
7070
7171/**
7272 * Translates the given message based on a count and watch for changes.
7373 */
74- export function wTransChoice (
75- key : string ,
76- number : number ,
77- replacements : ReplacementsInterface = { }
78- ) : ComputedRef < string > {
74+ export function wTransChoice ( key : string , number : number , replacements : Replacements = { } ) : ComputedRef < string > {
7975 return I18n . getSharedInstance ( ) . wTransChoice ( key , number , replacements )
8076}
8177
@@ -117,8 +113,8 @@ export const i18nVue: Plugin = {
117113
118114 const i18n = options . shared ? I18n . getSharedInstance ( options , true ) : new I18n ( options )
119115
120- app . config . globalProperties . $t = ( key : string , replacements : ReplacementsInterface ) => i18n . trans ( key , replacements )
121- app . config . globalProperties . $tChoice = ( key : string , number : number , replacements : ReplacementsInterface ) =>
116+ app . config . globalProperties . $t = ( key : string , replacements : Replacements ) => i18n . trans ( key , replacements )
117+ app . config . globalProperties . $tChoice = ( key : string , number : number , replacements : Replacements ) =>
122118 i18n . transChoice ( key , number , replacements )
123119
124120 app . provide ( 'i18n' , i18n )
@@ -398,14 +394,14 @@ export class I18n {
398394 /**
399395 * Get the translation for the given key.
400396 */
401- trans ( key : string , replacements : ReplacementsInterface = { } ) : string {
397+ trans ( key : string , replacements : Replacements = { } ) : string {
402398 return this . wTrans ( key , replacements ) . value
403399 }
404400
405401 /**
406402 * Get the translation for the given key and watch for any changes.
407403 */
408- wTrans ( key : string , replacements : ReplacementsInterface = { } ) : ComputedRef < string > {
404+ wTrans ( key : string , replacements : Replacements = { } ) : ComputedRef < string > {
409405 watchEffect ( ( ) => {
410406 let value = this . findTranslation ( key )
411407
@@ -422,18 +418,16 @@ export class I18n {
422418 /**
423419 * Translates the given message based on a count.
424420 */
425- transChoice ( key : string , number : number , replacements : ReplacementsInterface = { } ) : string {
421+ transChoice ( key : string , number : number , replacements : Replacements = { } ) : string {
426422 return this . wTransChoice ( key , number , replacements ) . value
427423 }
428424
429425 /**
430426 * Translates the given message based on a count and watch for changes.
431427 */
432- wTransChoice ( key : string , number : number , replacements : ReplacementsInterface = { } ) : ComputedRef < string > {
428+ wTransChoice ( key : string , number : number , replacements : Replacements = { } ) : ComputedRef < string > {
433429 const message = this . wTrans ( key , replacements )
434430
435- replacements . count = number . toString ( )
436-
437431 return computed ( ( ) => this . makeReplacements ( choose ( message . value , number , this . options . lang ) , replacements ) )
438432 }
439433
@@ -461,7 +455,7 @@ export class I18n {
461455 /**
462456 * Make the place-holder replacements on a line.
463457 */
464- makeReplacements ( message ?: string , replacements ?: ReplacementsInterface ) : string {
458+ makeReplacements ( message ?: string , replacements ?: Replacements ) : string {
465459 const capitalize = ( s : string ) => s . charAt ( 0 ) . toUpperCase ( ) + s . slice ( 1 )
466460
467461 Object . entries ( replacements || [ ] )
0 commit comments