QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.2k stars 54 forks source link

Is it possible to add support for namespaces like in i18next? #308

Closed 1Mouse closed 7 months ago

1Mouse commented 7 months ago

ref: https://www.i18next.com/principles/namespaces

namespaces allow us to have separate files for each page, is this possible with your library? Thanks in advance

salmanorak commented 7 months ago

@1Mouse , I think You can create namespaces in current feature set.

const ns1: {
  key1: 'value1',
  key2: 'value2'
} as const

const ns2: {
  key1: 'value1',
  key2: 'value2'
} as const

export default {
 ns1,
 ns2
}

then When You are going to use it


 const t = useI18n()
 ...
 const content = t('ns1.key1')

if You want You can create separate files for different name spaces and import them to index.ts.

1Mouse commented 7 months ago

fantastic thanks for your help