You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ## library
  2. - i18next
  3. - react-i18next
  4. ## hooks
  5. - useTranslation
  6. - useGetLanguage
  7. - useI18N
  8. - useRenderI18nObject
  9. ## impl
  10. - App Boot
  11. - app/layout.tsx load i18n and init context
  12. - use `<I18nServer/>`
  13. - read locale with `getLocaleOnServer` (in node.js)
  14. - locale from cookie, or browser request header
  15. - only used in client app init and 2 server code(plugin desc, datasets)
  16. - use `<I18N/>`
  17. - init i18n context
  18. - `setLocaleOnClient`
  19. - `changeLanguage` (defined in i18n/i18next-config, also init i18n resources (side effects))
  20. - is `i18next.changeLanguage`
  21. - all languages text is merge & load in FrontEnd as .js (see i18n/i18next-config)
  22. - i18n context
  23. - `locale` - current locale code (ex `eu-US`, `zh-Hans`)
  24. - `i18n` - useless
  25. - `setLocaleOnClient` - used by App Boot and user change language
  26. ### load i18n resources
  27. - client: i18n/i18next-config.ts
  28. - ns = camalCase(filename)
  29. - ex: `app/components/datasets/create/embedding-process/index.tsx`
  30. - `t('datasetSettings.form.retrievalSetting.title')`
  31. - server: i18n/server.ts
  32. - ns = filename
  33. - ex: `app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx`
  34. - `translate(locale, 'dataset-settings')`
  35. ## TODO
  36. - [ ] ts docs for useGetLanguage
  37. - [ ] ts docs for useI18N
  38. - [ ] client docs for i18n
  39. - [ ] server docs for i18n