Skip to content

Commit 636a472

Browse files
committed
feat: update next demo for better pluralization example
1 parent 12cd90f commit 636a472

7 files changed

Lines changed: 31 additions & 26 deletions

File tree

cmp/demo/next16/app/page.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Counter } from "@/components/counter";
1+
import { Counter } from "@/components/Counter";
22
import { LocaleSwitcher } from "@lingo.dev/_compiler/react";
33
import Link from "next/link";
4-
import { CounterServerChild } from "@/components/counterServerChild";
4+
import { ServerChild } from "@/components/ServerChild";
5+
import { ClientChildWrapper } from "@/components/ClientChildWrapper";
56

67
const externalText = <>External text</>;
78

@@ -26,7 +27,7 @@ export default function Home() {
2627
{ code: "en", label: "English" },
2728
{ code: "es", label: "Spanish" },
2829
{ code: "de", label: "Deutsch" },
29-
{ code: "fr", label: "Français" },
30+
{ code: "ru", label: "Русский" },
3031
]}
3132
/>
3233
</header>
@@ -40,9 +41,12 @@ export default function Home() {
4041
It supports both server and client components.
4142
</p>
4243
<div className="my-2">
43-
<Counter>
44-
<CounterServerChild />
45-
</Counter>
44+
<Counter />
45+
</div>
46+
<div className="my-2">
47+
<ClientChildWrapper>
48+
<ServerChild />
49+
</ClientChildWrapper>
4650
</div>
4751
<div>
4852
Text inserted as an <code>{"{expression}"}</code> is not translated:{" "}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use client";
2+
3+
import { FC, PropsWithChildren } from "react";
4+
5+
export const ClientChildWrapper: FC<PropsWithChildren> = ({ children }) => {
6+
return <div className="flex gap-2">{children}</div>;
7+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"use client";
2+
3+
import { FC, useState } from "react";
4+
5+
export const Counter: FC = () => {
6+
const [state, setState] = useState(0);
7+
return (
8+
<button onClick={() => setState((old) => old + 1)}>
9+
Clicked {state} times
10+
</button>
11+
);
12+
};
File renamed without changes.

cmp/demo/next16/components/counterServerChild.tsx renamed to cmp/demo/next16/components/ServerChild.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const CounterServerChild = () => {
1+
export const ServerChild = () => {
22
return (
33
<div className="flex gap-2">
44
<button>Rendered on the server</button>

cmp/demo/next16/components/counter.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

cmp/demo/next16/next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default withLingo(nextConfig, {
77
sourceRoot: "./app",
88
lingoDir: ".lingo",
99
sourceLocale: "en",
10-
targetLocales: ["es", "de", "fr"],
10+
targetLocales: ["es", "de", "ru"],
1111
useDirective: false, // Set to true to require 'use i18n' directive
1212
models: "lingo.dev",
1313
dev: {

0 commit comments

Comments
 (0)