@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
55import { getFormDisplay } from '@utils/getFormDisplay'
66
77/**
8- * @typedef {{ plural?: boolean, amount?: boolean, alt?: boolean, newLine?: boolean, quest?: boolean } } CustomTOptions
8+ * @typedef {{ plural?: boolean, amount?: boolean, alt?: boolean, newLine?: boolean, quest?: boolean, omitFormSuffix?: boolean } } CustomTOptions
99 * @typedef {(id: string, options?: CustomTOptions) => string } CustomT
1010 */
1111
@@ -19,7 +19,10 @@ export function useTranslateById(options = {}) {
1919 return useMemo (
2020 ( ) => ( {
2121 language : i18n . i18n . language ,
22- t : ( id , { plural, amount, alt, newLine, quest } = options ) => {
22+ t : (
23+ id ,
24+ { plural, amount, alt, newLine, quest, omitFormSuffix } = options ,
25+ ) => {
2326 if ( typeof id !== 'string' ) {
2427 return ''
2528 }
@@ -116,6 +119,7 @@ export function useTranslateById(options = {}) {
116119 ? ''
117120 : getFormDisplay ( pokemon , form , undefined , {
118121 showDefaultForms : quest ,
122+ appendFormSuffix : ! omitFormSuffix ,
119123 } )
120124 return formLabel
121125 ? `${ pokemonName } ${ newLine ? '\n' : ' ' } (${ formLabel } )`
@@ -124,6 +128,13 @@ export function useTranslateById(options = {}) {
124128 }
125129 } ,
126130 } ) ,
127- [ i18n , options . alt , options . amount , options . plural , options . newLine ] ,
131+ [
132+ i18n ,
133+ options . alt ,
134+ options . amount ,
135+ options . plural ,
136+ options . newLine ,
137+ options . omitFormSuffix ,
138+ ] ,
128139 )
129140}
0 commit comments