Skip to content
This repository was archived by the owner on Apr 12, 2023. It is now read-only.

Commit c4a7e23

Browse files
committed
i18n
1 parent ed280c1 commit c4a7e23

File tree

5 files changed

+33
-11
lines changed

5 files changed

+33
-11
lines changed

__tests__/index.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jest.mock('next/router', () => require('next-router-mock'));
88
describe("Home", () => {
99

1010
beforeEach(() => {
11-
mockRouter.locale = "no"
11+
mockRouter.locale = "nb"
1212
});
1313

1414
it("renders a heading", () => {

next.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const nextConfig = {
44
swcMinify: true,
55
output: 'standalone',
66
i18n: {
7-
locales: ['no', 'en'],
8-
defaultLocale: 'no',
7+
locales: ['nb', 'en'],
8+
defaultLocale: 'nb',
99
localeDetection: false
1010
},
1111
};

src/allTexts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ export type TextsType = {
88
}
99

1010
export type LocalesType = {
11-
no: TextsType;
11+
nb: TextsType;
1212
en: TextsType;
1313
}
1414

1515
const allTexts: LocalesType = {
16-
"no": {
16+
"nb": {
1717
"menuSend": "Send",
1818
"menuHistory": "Tidligere meldekort",
1919
"menuAbout": "Om meldekort",

src/pages/_document.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,30 @@ import {
33
Components as DecoratorComponents,
44
Env,
55
fetchDecoratorReact,
6-
Props as DecoratorProps,
6+
Locale,
7+
Props as DecoratorProps
78
} from "@navikt/nav-dekoratoren-moduler/ssr";
89

9-
const dekoratorProps: DecoratorProps = {
10-
env: process.env.NAV_DEKORATOREN_ENV as Env,
11-
chatbotVisible: true,
12-
};
13-
1410
export default class MyDocument extends Document<DecoratorComponents> {
1511
static async getInitialProps(ctx: DocumentContext) {
1612
const initialProps = await Document.getInitialProps(ctx);
1713

14+
const dekoratorProps: DecoratorProps = {
15+
env: process.env.NAV_DEKORATOREN_ENV as Env,
16+
chatbotVisible: true,
17+
availableLanguages: [
18+
{
19+
locale: "nb",
20+
url: "/"
21+
},
22+
{
23+
locale: "en",
24+
url: "/en"
25+
}
26+
],
27+
language: (ctx.locale || "nb") as Locale
28+
};
29+
1830
const Dekorator: DecoratorComponents = await fetchDecoratorReact({
1931
...dekoratorProps,
2032
}).catch((err) => {

styles/globals.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,13 @@ main {
3333
padding: 0 2rem;
3434
margin: 2rem auto 2rem;
3535
}
36+
37+
.decorator-utils-container {
38+
margin-bottom: -2.5rem;
39+
}
40+
41+
@media (min-width: 1100px) {
42+
.decorator-utils-container {
43+
margin-bottom: -5.9rem;
44+
}
45+
}

0 commit comments

Comments
 (0)