diff --git a/i18n/es.po b/i18n/es.po index 1f7ba5c..33a5fcf 100644 --- a/i18n/es.po +++ b/i18n/es.po @@ -15,7 +15,7 @@ msgid "- All -" msgstr "" msgid "Loading..." -msgstr "" +msgstr "Cargando..." msgid "Organisation unit" msgstr "" diff --git a/package.json b/package.json index 2589b0f..374ee6c 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "eject": "react-scripts eject", "prettify": "prettier \"./**/*.{js,jsx,json,css,ts,tsx}\" --write", "extract-pot": "yarn d2-i18n-extract -p src/ -o i18n/", - "localize": "yarn update-po && d2-i18n-generate -n d2-reports -p ./i18n/ -o ./src/locales/", + "localize": "yarn update-po && d2-i18n-generate -n d2-autogen-forms -p ./i18n/ -o ./src/locales/", "update-po": "yarn extract-pot && for pofile in i18n/*.po; do msgmerge --backup=off -U $pofile i18n/en.pot; done", "manifest": "d2-manifest package.json build/manifest.webapp", "configurator-manifest": "d2-manifest package.json manifest.webapp --manifest.version=$npm_package_appVersions_configurator --manifest.name='Autogenerated Forms Configurator' --manifest.description='Autogenerated Forms Configurator'", diff --git a/src/types/i18n.d.ts b/src/types/i18n.d.ts index 168a99a..636fc49 100644 --- a/src/types/i18n.d.ts +++ b/src/types/i18n.d.ts @@ -1,4 +1,5 @@ declare module "@dhis2/d2-i18n" { export function t(value: string, namespace?: object): string; export function changeLanguage(locale: string); + export function setDefaultNamespace(namespace: string); } diff --git a/src/webapp/contexts/app-context.ts b/src/webapp/contexts/app-context.ts index 4dbf00c..44bebbd 100644 --- a/src/webapp/contexts/app-context.ts +++ b/src/webapp/contexts/app-context.ts @@ -2,6 +2,7 @@ import React, { useContext } from "react"; import { CompositionRoot } from "../../compositionRoot"; import { Config } from "../../domain/common/entities/Config"; import { D2Api } from "../../types/d2-api"; +import i18n from "../../locales"; export interface AppContextState { api: D2Api; @@ -13,6 +14,7 @@ export const AppContext = React.createContext(null); export function useAppContext() { const context = useContext(AppContext); + i18n.setDefaultNamespace("d2-autogen-forms"); if (context) { return context; } else {