Skip to content

Commit

Permalink
fix: set default app namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
deeonwuli committed Jun 25, 2024
1 parent 47d9d59 commit 004d6d1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

msgid "Select Dashboard"
msgstr ""
msgstr "Seleccionar panel"

msgid "Select Month"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,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 dhis2-skeleton-app -p ./i18n/ -o ./src/locales/",
"localize": "yarn update-po && d2-i18n-generate -n dashboard-reports -p ./i18n/ -o ./src/locales/",
"update-po": "yarn extract-pot && find i18n/ -name '*.po' -exec msgmerge --backup=off -U {} i18n/en.pot \\;",
"manifest": "d2-manifest package.json build/manifest.webapp",
"cy:verify": "cypress verify",
Expand Down
1 change: 1 addition & 0 deletions src/types/i18n.d.ts
Original file line number Diff line number Diff line change
@@ -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);
}
2 changes: 2 additions & 0 deletions src/webapp/contexts/app-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CompositionRoot } from "../../CompositionRoot";
import { Settings } from "../../domain/entities/Settings";
import { User } from "../../domain/entities/User";
import { D2Api } from "../../types/d2-api";
import i18n from "../../locales";

export interface AppContextState {
api: D2Api;
Expand All @@ -17,6 +18,7 @@ export const AppContext = React.createContext<AppContextState | null>(null);

export function useAppContext() {
const context = useContext(AppContext);
i18n.setDefaultNamespace("dashboard-reports");
if (context) {
return context;
} else {
Expand Down

0 comments on commit 004d6d1

Please sign in to comment.