Namespaces & JSON resources
Smart Supply Pro uses namespaced translation
bundles, loaded from public/locales/.
File layout
The backend loader path is:
public/locales/{lng}/{ns}.json
Example (English):
frontend/public/locales/en/common.jsonfrontend/public/locales/en/inventory.jsonfrontend/public/locales/en/help.json
Example (German):
frontend/public/locales/de/common.jsonfrontend/public/locales/de/inventory.jsonfrontend/public/locales/de/help.json
Namespace responsibilities
common: shared/global UI (navigation, generic actions)<domain>namespaces (inventory,suppliers,analytics, …): domain-specific UIsystem: system-level pages (404, generic system states)errors: user-facing error messageshelp: help topic text (titles + body + optional link label)
How namespaces are declared
- The canonical namespace list is a constant in
frontend/src/i18n/index.ts. - That list is also used to load all namespaces at startup.
Adding a new translation key
- Add the key under the appropriate namespace JSON:
frontend/public/locales/en/<ns>.jsonfrontend/public/locales/de/<ns>.json
- If you added a new namespace file:
- add it to the namespace list constant
- add it to
frontend/src/i18n/resources.d.tsimports andresourcesmap
- Use it from code:
const { t } = useTranslation('<ns>')t('<path.to.key>')
Help topics as i18n-backed content
Help topics are registered in
frontend/src/help/topics.ts.
Each topic maps to i18n keys like:
help:<topicId>.titlehelp:<topicId>.body
This keeps help content localized and centralized.
graph LR
Topics[HELP_TOPICS registry] --> Keys[i18n keys
help:*.title/body]
Keys --> JSON[public/locales/{lng}/help.json]
JSON --> UI[Help UI renders t(key)]