Skip to content

Commit ac35dd2

Browse files
examples: fix paraglide start example (#5344)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent cc52bd7 commit ac35dd2

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

examples/react/start-i18n-paraglide/src/routes/index.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,21 @@ const getServerMessage = createServerFn()
1111

1212
export const Route = createFileRoute('/')({
1313
component: Home,
14-
loader: () => {
14+
loader: async () => {
1515
return {
16-
localeFromLoader: getLocale(),
1716
messageFromLoader: m.example_message({ username: 'John Doe' }),
18-
serverFunctionMessage: getServerMessage({ data: '📩' }),
17+
serverFunctionMessage: await getServerMessage({ data: '📩' }),
1918
}
2019
},
2120
})
2221

2322
function Home() {
24-
const { serverFunctionMessage, messageFromLoader, localeFromLoader } =
25-
Route.useLoaderData()
23+
const { serverFunctionMessage, messageFromLoader } = Route.useLoaderData()
2624
return (
2725
<div className="p-2">
2826
<h2>Message from loader: {messageFromLoader}</h2>
2927
<h2>Server function message: {serverFunctionMessage}:</h2>
30-
<h3>{m.example_message({ username: 'John Doe' })}</h3>
28+
<h2>{m.example_message({ username: 'John Doe' })}</h2>
3129
</div>
3230
)
3331
}

examples/react/start-i18n-paraglide/vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ const config = defineConfig({
1414
cookieName: 'PARAGLIDE_LOCALE',
1515
strategy: ['url', 'cookie', 'preferredLanguage', 'baseLocale'],
1616
urlPatterns: [
17+
{
18+
pattern: '/',
19+
localized: [
20+
['en', '/en'],
21+
['de', '/de'],
22+
],
23+
},
1724
{
1825
pattern: '/about',
1926
localized: [

0 commit comments

Comments
 (0)