File tree Expand file tree Collapse file tree 3 files changed +14
-15
lines changed Expand file tree Collapse file tree 3 files changed +14
-15
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @scaleway/use-i18n ' : minor
3+ ---
4+
5+ enableDebugKey should always return the key
Original file line number Diff line number Diff line change @@ -297,17 +297,11 @@ describe('i18n hook', () => {
297297 expect ( result . current . t ( 'test' ) ) . toEqual ( 'test' )
298298
299299 await waitFor ( ( ) => {
300- expect ( result . current . t ( 'title' ) ) . toEqual ( en . title )
301- expect ( result . current . t ( 'subtitle' ) ) . toEqual ( en . subtitle )
302- expect ( result . current . t ( 'plurals' , { numPhotos : 0 } ) ) . toEqual (
303- 'You have no photos.' ,
304- )
305- expect ( result . current . t ( 'plurals' , { numPhotos : 1 } ) ) . toEqual (
306- 'You have one photo.' ,
307- )
308- expect ( result . current . t ( 'plurals' , { numPhotos : 2 } ) ) . toEqual (
309- 'You have 2 photos.' ,
310- )
300+ expect ( result . current . t ( 'title' ) ) . toEqual ( 'title' )
301+ expect ( result . current . t ( 'subtitle' ) ) . toEqual ( 'subtitle' )
302+ expect ( result . current . t ( 'plurals' , { numPhotos : 0 } ) ) . toEqual ( 'plurals' )
303+ expect ( result . current . t ( 'plurals' , { numPhotos : 1 } ) ) . toEqual ( 'plurals' )
304+ expect ( result . current . t ( 'plurals' , { numPhotos : 2 } ) ) . toEqual ( 'plurals' )
311305 } )
312306 } )
313307
Original file line number Diff line number Diff line change @@ -330,11 +330,11 @@ const I18nContextProvider = ({
330330 const translate = useCallback (
331331 ( key : string , context ?: ReactParamsObject < any > ) => {
332332 const value = translations [ currentLocale ] ?. [ key ] as string
333- if ( ! value ) {
334- if ( enableDebugKey ) {
335- return key
336- }
333+ if ( enableDebugKey ) {
334+ return key
335+ }
337336
337+ if ( ! value ) {
338338 return ''
339339 }
340340 if ( context ) {
You can’t perform that action at this time.
0 commit comments