Skip to content

Commit

Permalink
set app namespace in appcontext
Browse files Browse the repository at this point in the history
  • Loading branch information
eperedo committed Jun 4, 2024
1 parent 2b71d7b commit 07b2bd2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
7 changes: 5 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-05-06T08:44:12.108Z\n"
"PO-Revision-Date: 2024-05-06T08:44:12.108Z\n"
"POT-Creation-Date: 2024-06-04T15:47:01.351Z\n"
"PO-Revision-Date: 2024-06-04T15:47:01.351Z\n"

msgid "There are pending migrations"
msgstr ""
Expand Down Expand Up @@ -470,6 +470,9 @@ msgstr ""
msgid "Loading the user configuration..."
msgstr ""

msgid "Available Home Pages"
msgstr ""

msgid "Create"
msgstr ""

Expand Down
5 changes: 4 additions & 1 deletion i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-05-06T08:44:12.108Z\n"
"POT-Creation-Date: 2024-06-04T15:47:01.351Z\n"
"PO-Revision-Date: 2018-10-25T09:02:35.143Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -469,6 +469,9 @@ msgstr ""
msgid "Loading the user configuration..."
msgstr ""

msgid "Available Home Pages"
msgstr "Páginas de inicio disponibles"

msgid "Create"
msgstr ""

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);
}
1 change: 1 addition & 0 deletions src/webapp/contexts/app-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ async function getLaunchAppBaseUrl() {

export function useAppContext(): AppContextState {
const context = useContext(AppContext);
i18n.setDefaultNamespace("homepage-app");
if (context) {
return context;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/webapp/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export const HomePage: React.FC = React.memo(() => {
</ProgressContainer>
) : initLandings && pageType === "userLandings" ? (
<>
<h1>Available Home Pages</h1>
<h1>{i18n.t("Available Home Pages")}</h1>
<Cardboard rowSize={4}>
{initLandings?.map(landing => {
return (
Expand Down

0 comments on commit 07b2bd2

Please sign in to comment.