@cbnventures/nova 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/package.json +1 -1
- package/build/src/lib/docker-packaging.d.ts.map +1 -1
- package/build/src/lib/docker-packaging.js +4 -0
- package/build/src/lib/docker-packaging.js.map +1 -1
- package/build/src/types/tests/cli/scaffold/app/android.test.d.ts +2 -0
- package/build/src/types/tests/scaffold-output-contract.test.d.ts +27 -0
- package/build/templates/scaffold/app/android/package.json +1 -1
- package/build/templates/scaffold/app/apple/Sources/ContentView.swift +6 -6
- package/build/templates/scaffold/app/apple/Sources/Localizable.xcstrings +75 -0
- package/build/templates/scaffold/app/apple/package.json +1 -1
- package/build/templates/scaffold/app/astro/package.json +1 -1
- package/build/templates/scaffold/app/astro/src/i18n/en.json +48 -0
- package/build/templates/scaffold/app/astro/src/pages/index.astro +31 -30
- package/build/templates/scaffold/app/discord-bot/package.json +1 -1
- package/build/templates/scaffold/app/express/package.json +1 -1
- package/build/templates/scaffold/app/nextjs/package.json +1 -1
- package/build/templates/scaffold/app/nextjs/src/app/[lang]/dictionaries/en.json +31 -0
- package/build/templates/scaffold/app/nextjs/src/app/[lang]/dictionaries.ts +33 -0
- package/build/templates/scaffold/app/nextjs/src/app/[lang]/layout.tsx +92 -0
- package/build/templates/scaffold/app/nextjs/src/app/{page.tsx → [lang]/page.tsx} +54 -34
- package/build/templates/scaffold/app/nextjs/src/i18n/config.ts +42 -0
- package/build/templates/scaffold/app/nextjs/src/proxy.ts +56 -0
- package/build/templates/scaffold/app/nextjs/src/types/app/[lang]/dictionaries.d.ts +21 -0
- package/build/templates/scaffold/app/nextjs/src/types/app/[lang]/layout.d.ts +63 -0
- package/build/templates/scaffold/app/nextjs/src/types/app/[lang]/page.d.ts +22 -0
- package/build/templates/scaffold/app/nextjs/src/types/i18n/config.d.ts +22 -0
- package/build/templates/scaffold/app/nextjs/src/types/proxy.d.ts +30 -0
- package/build/templates/scaffold/app/vite/package.json +1 -1
- package/build/templates/scaffold/docs/docusaurus/package.json +2 -2
- package/build/templates/scaffold/docs/docusaurus/src/pages/index.tsx +81 -20
- package/build/templates/scaffold/package/github-action/package.json +1 -1
- package/build/templates/scaffold/package/homebridge/package.json +1 -1
- package/build/templates/scaffold/package/pfsense/package.json +1 -1
- package/build/templates/scaffold-options/app/android-launchpad/app/src/main/java/[__ANDROID_PACKAGE_PATH__]/ui/main/MainScreen.kt +40 -34
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/values/strings.xml +27 -0
- package/build/templates/scaffold-options/app/astro/cloudflare/astro.config.mjs +7 -0
- package/build/templates/scaffold-options/app/astro/node/astro.config.mjs +7 -0
- package/build/templates/scaffold-options/app/astro/static/astro.config.mjs +7 -0
- package/build/templates/scaffold-options/docker-image/common/Dockerfile +1 -0
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +1 -1
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +1 -1
- package/package.json +1 -1
- package/build/templates/scaffold/app/nextjs/src/app/layout.tsx +0 -46
- package/build/templates/scaffold/app/nextjs/src/types/app/layout.d.ts +0 -25
- package/build/templates/scaffold/app/nextjs/src/types/app/page.d.ts +0 -8
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
+
import messages from '../i18n/en.json';
|
|
2
3
|
import '../styles/nova-launchpad.css';
|
|
3
4
|
---
|
|
4
5
|
|
|
5
6
|
<!doctype html>
|
|
6
|
-
<html lang=
|
|
7
|
+
<html lang={Astro.currentLocale ?? 'en'}>
|
|
7
8
|
<head>
|
|
8
9
|
<meta charset="UTF-8" />
|
|
9
10
|
<meta name="viewport" content="width=device-width" />
|
|
10
11
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
11
|
-
<title>
|
|
12
|
+
<title>{messages.metadata.title}</title>
|
|
12
13
|
</head>
|
|
13
14
|
<body>
|
|
14
15
|
<main class="nova-launchpad" data-nova-framework="astro">
|
|
@@ -16,81 +17,81 @@ import '../styles/nova-launchpad.css';
|
|
|
16
17
|
<header class="nova-launchpad__header">
|
|
17
18
|
<div class="nova-launchpad__brand">
|
|
18
19
|
<svg class="nova-launchpad__mark" aria-hidden="true" viewBox="0 0 1024 1024"><use href="/nova-socials.svg#nova"></use></svg>
|
|
19
|
-
<span>
|
|
20
|
+
<span>{messages.brand.nova}</span>
|
|
20
21
|
<span class="nova-launchpad__cross">×</span>
|
|
21
|
-
<span>
|
|
22
|
+
<span>{messages.brand.framework}</span>
|
|
22
23
|
</div>
|
|
23
24
|
<a class="nova-launchpad__docs-link" href="https://nova.cbnventures.io/docs/quickstart/" target="_blank" rel="noreferrer">
|
|
24
|
-
|
|
25
|
+
{messages.header.readNovaDocs}
|
|
25
26
|
</a>
|
|
26
27
|
</header>
|
|
27
28
|
<div class="nova-launchpad__body">
|
|
28
29
|
<section>
|
|
29
30
|
<h1 class="nova-launchpad__title">
|
|
30
|
-
<span>
|
|
31
|
-
<span class="nova-launchpad__title-accent">
|
|
31
|
+
<span>{messages.introduction.title}</span>
|
|
32
|
+
<span class="nova-launchpad__title-accent">{messages.introduction.titleAccent}</span>
|
|
32
33
|
</h1>
|
|
33
34
|
<p class="nova-launchpad__lede">
|
|
34
|
-
|
|
35
|
+
{messages.introduction.description}
|
|
35
36
|
</p>
|
|
36
37
|
<div class="nova-launchpad__actions">
|
|
37
38
|
<a class="nova-launchpad__primary-link" href="https://docs.astro.build" target="_blank" rel="noreferrer">
|
|
38
|
-
|
|
39
|
+
{messages.introduction.exploreDocs}
|
|
39
40
|
</a>
|
|
40
41
|
<span class="nova-launchpad__edit-hint">
|
|
41
|
-
|
|
42
|
+
{messages.introduction.editHint} <code>src/pages/index.astro</code>
|
|
42
43
|
</span>
|
|
43
44
|
</div>
|
|
44
45
|
</section>
|
|
45
|
-
<aside class="nova-launchpad__sequence" aria-label=
|
|
46
|
-
<p class="nova-launchpad__sequence-label">
|
|
46
|
+
<aside class="nova-launchpad__sequence" aria-label={messages.sequence.label}>
|
|
47
|
+
<p class="nova-launchpad__sequence-label">{messages.sequence.label}</p>
|
|
47
48
|
<ol class="nova-launchpad__steps">
|
|
48
49
|
<li class="nova-launchpad__step">
|
|
49
|
-
<span class="nova-launchpad__step-number">
|
|
50
|
+
<span class="nova-launchpad__step-number">{messages.sequence.stepOne.number}</span>
|
|
50
51
|
<div>
|
|
51
|
-
<strong>
|
|
52
|
-
<p>
|
|
52
|
+
<strong>{messages.sequence.stepOne.title}</strong>
|
|
53
|
+
<p>{messages.sequence.stepOne.description}</p>
|
|
53
54
|
</div>
|
|
54
55
|
</li>
|
|
55
56
|
<li class="nova-launchpad__step">
|
|
56
|
-
<span class="nova-launchpad__step-number">
|
|
57
|
+
<span class="nova-launchpad__step-number">{messages.sequence.stepTwo.number}</span>
|
|
57
58
|
<div>
|
|
58
|
-
<strong>
|
|
59
|
-
<p>
|
|
59
|
+
<strong>{messages.sequence.stepTwo.title}</strong>
|
|
60
|
+
<p>{messages.sequence.stepTwo.description}</p>
|
|
60
61
|
</div>
|
|
61
62
|
</li>
|
|
62
63
|
<li class="nova-launchpad__step">
|
|
63
|
-
<span class="nova-launchpad__step-number">
|
|
64
|
+
<span class="nova-launchpad__step-number">{messages.sequence.stepThree.number}</span>
|
|
64
65
|
<div>
|
|
65
|
-
<strong>
|
|
66
|
-
<p>
|
|
66
|
+
<strong>{messages.sequence.stepThree.title}</strong>
|
|
67
|
+
<p>{messages.sequence.stepThree.description}</p>
|
|
67
68
|
</div>
|
|
68
69
|
</li>
|
|
69
70
|
</ol>
|
|
70
71
|
</aside>
|
|
71
72
|
</div>
|
|
72
73
|
<footer class="nova-launchpad__footer">
|
|
73
|
-
<span>
|
|
74
|
-
<nav class="nova-launchpad__socials" aria-label=
|
|
75
|
-
<a class="nova-launchpad__social-link" href="https://www.facebook.com/cbnventures" target="_blank" rel="noreferrer" aria-label=
|
|
74
|
+
<span>{messages.footer.credit}</span>
|
|
75
|
+
<nav class="nova-launchpad__socials" aria-label={messages.footer.socialLabel}>
|
|
76
|
+
<a class="nova-launchpad__social-link" href="https://www.facebook.com/cbnventures" target="_blank" rel="noreferrer" aria-label={messages.footer.facebook}>
|
|
76
77
|
<svg class="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#facebook"></use></svg>
|
|
77
78
|
</a>
|
|
78
|
-
<a class="nova-launchpad__social-link" href="https://x.com/cbnventures" target="_blank" rel="noreferrer" aria-label=
|
|
79
|
+
<a class="nova-launchpad__social-link" href="https://x.com/cbnventures" target="_blank" rel="noreferrer" aria-label={messages.footer.x}>
|
|
79
80
|
<svg class="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#x"></use></svg>
|
|
80
81
|
</a>
|
|
81
|
-
<a class="nova-launchpad__social-link" href="https://www.youtube.com/@cbnventures" target="_blank" rel="noreferrer" aria-label=
|
|
82
|
+
<a class="nova-launchpad__social-link" href="https://www.youtube.com/@cbnventures" target="_blank" rel="noreferrer" aria-label={messages.footer.youtube}>
|
|
82
83
|
<svg class="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#youtube"></use></svg>
|
|
83
84
|
</a>
|
|
84
|
-
<a class="nova-launchpad__social-link" href="https://www.instagram.com/cbnventures/" target="_blank" rel="noreferrer" aria-label=
|
|
85
|
+
<a class="nova-launchpad__social-link" href="https://www.instagram.com/cbnventures/" target="_blank" rel="noreferrer" aria-label={messages.footer.instagram}>
|
|
85
86
|
<svg class="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#instagram"></use></svg>
|
|
86
87
|
</a>
|
|
87
|
-
<a class="nova-launchpad__social-link" href="https://github.com/cbnventures" target="_blank" rel="noreferrer" aria-label=
|
|
88
|
+
<a class="nova-launchpad__social-link" href="https://github.com/cbnventures" target="_blank" rel="noreferrer" aria-label={messages.footer.github}>
|
|
88
89
|
<svg class="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#github"></use></svg>
|
|
89
90
|
</a>
|
|
90
|
-
<a class="nova-launchpad__social-link" href="https://play.google.com/store/apps/dev?id=6419450160526226105" target="_blank" rel="noreferrer" aria-label=
|
|
91
|
+
<a class="nova-launchpad__social-link" href="https://play.google.com/store/apps/dev?id=6419450160526226105" target="_blank" rel="noreferrer" aria-label={messages.footer.googlePlay}>
|
|
91
92
|
<svg class="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#google-play"></use></svg>
|
|
92
93
|
</a>
|
|
93
|
-
<a class="nova-launchpad__social-link" href="https://www.linkedin.com/company/cbnventures/" target="_blank" rel="noreferrer" aria-label=
|
|
94
|
+
<a class="nova-launchpad__social-link" href="https://www.linkedin.com/company/cbnventures/" target="_blank" rel="noreferrer" aria-label={messages.footer.linkedin}>
|
|
94
95
|
<svg class="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#linkedin"></use></svg>
|
|
95
96
|
</a>
|
|
96
97
|
</nav>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"node": "[__SCAFFOLD_VERSION_NODE_ENGINE__]"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@cbnventures/nova": "0.
|
|
27
|
+
"@cbnventures/nova": "0.35.0",
|
|
28
28
|
"next": "[__SCAFFOLD_VERSION_NEXT__]",
|
|
29
29
|
"react": "[__SCAFFOLD_VERSION_REACT__]",
|
|
30
30
|
"react-dom": "[__SCAFFOLD_VERSION_REACT_DOM__]"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadataTitle": "Nova × Next.js",
|
|
3
|
+
"metadataDescription": "A Nova-managed Next.js application",
|
|
4
|
+
"brandNova": "Nova",
|
|
5
|
+
"brandFramework": "Next.js",
|
|
6
|
+
"readNovaDocs": "Read Nova Docs ↗",
|
|
7
|
+
"title": "Next.js",
|
|
8
|
+
"titleAccent": "starts here.",
|
|
9
|
+
"description": "A production-ready Next.js workspace with strict checks, tests, and a clean path from first edit to deployment.",
|
|
10
|
+
"exploreDocs": "Explore Next.js docs ↗",
|
|
11
|
+
"editHint": "Start in",
|
|
12
|
+
"launchSequence": "Launch sequence",
|
|
13
|
+
"stepOneNumber": "01",
|
|
14
|
+
"stepOneTitle": "Shape the experience",
|
|
15
|
+
"stepOneDescription": "Replace this starter with your first real product experience.",
|
|
16
|
+
"stepTwoNumber": "02",
|
|
17
|
+
"stepTwoTitle": "Keep the contract",
|
|
18
|
+
"stepTwoDescription": "Run the workspace checks while the project takes shape.",
|
|
19
|
+
"stepThreeNumber": "03",
|
|
20
|
+
"stepThreeTitle": "Ship confidently",
|
|
21
|
+
"stepThreeDescription": "Build the same production artifact Nova already validates.",
|
|
22
|
+
"footerCredit": "Generated with Nova",
|
|
23
|
+
"socialLabel": "CBN Ventures social media",
|
|
24
|
+
"facebook": "Facebook",
|
|
25
|
+
"x": "X",
|
|
26
|
+
"youtube": "YouTube",
|
|
27
|
+
"instagram": "Instagram",
|
|
28
|
+
"github": "GitHub",
|
|
29
|
+
"googlePlay": "Google Play",
|
|
30
|
+
"linkedin": "LinkedIn"
|
|
31
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
App_Lang_Dictionaries_Dictionaries,
|
|
3
|
+
App_Lang_Dictionaries_GetDictionary_Locale,
|
|
4
|
+
App_Lang_Dictionaries_GetDictionary_Returns,
|
|
5
|
+
} from '../../types/app/[lang]/dictionaries.d.ts';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Dictionaries - Dictionaries.
|
|
9
|
+
*
|
|
10
|
+
* Lazily loads only the dictionary required by the active locale route.
|
|
11
|
+
* Add another loader when the application gains another locale.
|
|
12
|
+
*
|
|
13
|
+
* @since 0.0.0
|
|
14
|
+
*/
|
|
15
|
+
const dictionaries: App_Lang_Dictionaries_Dictionaries = {
|
|
16
|
+
en: async () => (await import('./dictionaries/en.json')).default,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Dictionaries - Get Dictionary.
|
|
21
|
+
*
|
|
22
|
+
* Loads the server-side message catalog for a supported locale.
|
|
23
|
+
* Keeps dictionary loading on the server and out of the client bundle.
|
|
24
|
+
*
|
|
25
|
+
* @param {App_Lang_Dictionaries_GetDictionary_Locale} locale - Locale.
|
|
26
|
+
*
|
|
27
|
+
* @returns {App_Lang_Dictionaries_GetDictionary_Returns}
|
|
28
|
+
*
|
|
29
|
+
* @since 0.0.0
|
|
30
|
+
*/
|
|
31
|
+
export function getDictionary(locale: App_Lang_Dictionaries_GetDictionary_Locale): App_Lang_Dictionaries_GetDictionary_Returns {
|
|
32
|
+
return dictionaries[locale]();
|
|
33
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { notFound } from 'next/navigation';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
hasLocale,
|
|
5
|
+
locales,
|
|
6
|
+
} from '../../i18n/config';
|
|
7
|
+
import '../../styles/nova-launchpad.css';
|
|
8
|
+
import '../globals.css';
|
|
9
|
+
import { getDictionary } from './dictionaries';
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
App_Lang_Layout_GenerateMetadata_Dictionary,
|
|
13
|
+
App_Lang_Layout_GenerateMetadata_Params,
|
|
14
|
+
App_Lang_Layout_GenerateMetadata_Props,
|
|
15
|
+
App_Lang_Layout_GenerateMetadata_Returns,
|
|
16
|
+
App_Lang_Layout_GenerateStaticParams_Returns,
|
|
17
|
+
App_Lang_Layout_RootLayout_Params,
|
|
18
|
+
App_Lang_Layout_RootLayout_Props,
|
|
19
|
+
App_Lang_Layout_RootLayout_Returns,
|
|
20
|
+
} from '../../types/app/[lang]/layout.d.ts';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Layout - Generate Metadata.
|
|
24
|
+
*
|
|
25
|
+
* Uses the active locale dictionary for page title and description metadata.
|
|
26
|
+
* Keeps translated document metadata aligned with the rendered locale route.
|
|
27
|
+
*
|
|
28
|
+
* @param {App_Lang_Layout_GenerateMetadata_Props} props - Props.
|
|
29
|
+
*
|
|
30
|
+
* @returns {App_Lang_Layout_GenerateMetadata_Returns}
|
|
31
|
+
*
|
|
32
|
+
* @since 0.0.0
|
|
33
|
+
*/
|
|
34
|
+
export async function generateMetadata(props: App_Lang_Layout_GenerateMetadata_Props): App_Lang_Layout_GenerateMetadata_Returns {
|
|
35
|
+
const params: App_Lang_Layout_GenerateMetadata_Params = await props['params'];
|
|
36
|
+
|
|
37
|
+
if (hasLocale(params['lang']) === false) {
|
|
38
|
+
notFound();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const dictionary: App_Lang_Layout_GenerateMetadata_Dictionary = await getDictionary(params['lang']);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
title: dictionary['metadataTitle'],
|
|
45
|
+
description: dictionary['metadataDescription'],
|
|
46
|
+
icons: {
|
|
47
|
+
icon: '/favicon.svg',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Layout - Generate Static Params.
|
|
54
|
+
*
|
|
55
|
+
* Prepares one statically renderable route for every configured locale.
|
|
56
|
+
* English remains the only generated route until consumers add more locales.
|
|
57
|
+
*
|
|
58
|
+
* @returns {App_Lang_Layout_GenerateStaticParams_Returns}
|
|
59
|
+
*
|
|
60
|
+
* @since 0.0.0
|
|
61
|
+
*/
|
|
62
|
+
export function generateStaticParams(): App_Lang_Layout_GenerateStaticParams_Returns {
|
|
63
|
+
return locales.map((lang) => ({ lang }));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Layout - Root Layout.
|
|
68
|
+
*
|
|
69
|
+
* Wraps every localized application route in the shared HTML document.
|
|
70
|
+
* Unsupported locale segments resolve through Next.js's not-found boundary.
|
|
71
|
+
*
|
|
72
|
+
* @param {App_Lang_Layout_RootLayout_Props} props - Props.
|
|
73
|
+
*
|
|
74
|
+
* @returns {App_Lang_Layout_RootLayout_Returns}
|
|
75
|
+
*
|
|
76
|
+
* @since 0.0.0
|
|
77
|
+
*/
|
|
78
|
+
async function RootLayout(props: App_Lang_Layout_RootLayout_Props): App_Lang_Layout_RootLayout_Returns {
|
|
79
|
+
const params: App_Lang_Layout_RootLayout_Params = await props['params'];
|
|
80
|
+
|
|
81
|
+
if (hasLocale(params['lang']) === false) {
|
|
82
|
+
notFound();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<html lang={params['lang']}>
|
|
87
|
+
<body>{props['children']}</body>
|
|
88
|
+
</html>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default RootLayout;
|
|
@@ -1,99 +1,119 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { notFound } from 'next/navigation';
|
|
2
|
+
|
|
3
|
+
import { hasLocale } from '../../i18n/config';
|
|
4
|
+
import { getDictionary } from './dictionaries';
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
App_Lang_Page_Home_Dictionary,
|
|
8
|
+
App_Lang_Page_Home_Params,
|
|
9
|
+
App_Lang_Page_Home_Props,
|
|
10
|
+
App_Lang_Page_Home_Returns,
|
|
11
|
+
} from '../../types/app/[lang]/page.d.ts';
|
|
2
12
|
|
|
3
13
|
/**
|
|
4
14
|
* Page - Home.
|
|
5
15
|
*
|
|
6
|
-
* Renders the generated application landing page
|
|
7
|
-
*
|
|
16
|
+
* Renders the generated application landing page from the active locale's
|
|
17
|
+
* server-side dictionary.
|
|
18
|
+
*
|
|
19
|
+
* @param {App_Lang_Page_Home_Props} props - Props.
|
|
8
20
|
*
|
|
9
|
-
* @returns {
|
|
21
|
+
* @returns {App_Lang_Page_Home_Returns}
|
|
10
22
|
*
|
|
11
23
|
* @since 0.0.0
|
|
12
24
|
*/
|
|
13
|
-
function Home():
|
|
25
|
+
async function Home(props: App_Lang_Page_Home_Props): App_Lang_Page_Home_Returns {
|
|
26
|
+
const params: App_Lang_Page_Home_Params = await props['params'];
|
|
27
|
+
|
|
28
|
+
if (hasLocale(params['lang']) === false) {
|
|
29
|
+
notFound();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const dictionary: App_Lang_Page_Home_Dictionary = await getDictionary(params['lang']);
|
|
33
|
+
|
|
14
34
|
return (
|
|
15
35
|
<main className="nova-launchpad" data-nova-framework="nextjs">
|
|
16
36
|
<div className="nova-launchpad__shell">
|
|
17
37
|
<header className="nova-launchpad__header">
|
|
18
38
|
<div className="nova-launchpad__brand">
|
|
19
39
|
<svg className="nova-launchpad__mark" aria-hidden="true" viewBox="0 0 1024 1024"><use href="/nova-socials.svg#nova" /></svg>
|
|
20
|
-
<span>
|
|
40
|
+
<span>{dictionary['brandNova']}</span>
|
|
21
41
|
<span className="nova-launchpad__cross">×</span>
|
|
22
|
-
<span>
|
|
42
|
+
<span>{dictionary['brandFramework']}</span>
|
|
23
43
|
</div>
|
|
24
44
|
<a className="nova-launchpad__docs-link" href="https://nova.cbnventures.io/docs/quickstart/" target="_blank" rel="noreferrer">
|
|
25
|
-
|
|
45
|
+
{dictionary['readNovaDocs']}
|
|
26
46
|
</a>
|
|
27
47
|
</header>
|
|
28
48
|
<div className="nova-launchpad__body">
|
|
29
49
|
<section>
|
|
30
50
|
<h1 className="nova-launchpad__title">
|
|
31
|
-
<span>
|
|
32
|
-
<span className="nova-launchpad__title-accent">
|
|
51
|
+
<span>{dictionary['title']}</span>
|
|
52
|
+
<span className="nova-launchpad__title-accent">{dictionary['titleAccent']}</span>
|
|
33
53
|
</h1>
|
|
34
54
|
<p className="nova-launchpad__lede">
|
|
35
|
-
|
|
55
|
+
{dictionary['description']}
|
|
36
56
|
</p>
|
|
37
57
|
<div className="nova-launchpad__actions">
|
|
38
58
|
<a className="nova-launchpad__primary-link" href="https://nextjs.org/docs" target="_blank" rel="noreferrer">
|
|
39
|
-
|
|
59
|
+
{dictionary['exploreDocs']}
|
|
40
60
|
</a>
|
|
41
61
|
<span className="nova-launchpad__edit-hint">
|
|
42
|
-
|
|
62
|
+
{dictionary['editHint']}
|
|
43
63
|
{' '}
|
|
44
|
-
<code>src/app/page.tsx</code>
|
|
64
|
+
<code>src/app/[lang]/page.tsx</code>
|
|
45
65
|
</span>
|
|
46
66
|
</div>
|
|
47
67
|
</section>
|
|
48
|
-
<aside className="nova-launchpad__sequence" aria-label=
|
|
49
|
-
<p className="nova-launchpad__sequence-label">
|
|
68
|
+
<aside className="nova-launchpad__sequence" aria-label={dictionary['launchSequence']}>
|
|
69
|
+
<p className="nova-launchpad__sequence-label">{dictionary['launchSequence']}</p>
|
|
50
70
|
<ol className="nova-launchpad__steps">
|
|
51
71
|
<li className="nova-launchpad__step">
|
|
52
|
-
<span className="nova-launchpad__step-number">
|
|
72
|
+
<span className="nova-launchpad__step-number">{dictionary['stepOneNumber']}</span>
|
|
53
73
|
<div>
|
|
54
|
-
<strong>
|
|
55
|
-
<p>
|
|
74
|
+
<strong>{dictionary['stepOneTitle']}</strong>
|
|
75
|
+
<p>{dictionary['stepOneDescription']}</p>
|
|
56
76
|
</div>
|
|
57
77
|
</li>
|
|
58
78
|
<li className="nova-launchpad__step">
|
|
59
|
-
<span className="nova-launchpad__step-number">
|
|
79
|
+
<span className="nova-launchpad__step-number">{dictionary['stepTwoNumber']}</span>
|
|
60
80
|
<div>
|
|
61
|
-
<strong>
|
|
62
|
-
<p>
|
|
81
|
+
<strong>{dictionary['stepTwoTitle']}</strong>
|
|
82
|
+
<p>{dictionary['stepTwoDescription']}</p>
|
|
63
83
|
</div>
|
|
64
84
|
</li>
|
|
65
85
|
<li className="nova-launchpad__step">
|
|
66
|
-
<span className="nova-launchpad__step-number">
|
|
86
|
+
<span className="nova-launchpad__step-number">{dictionary['stepThreeNumber']}</span>
|
|
67
87
|
<div>
|
|
68
|
-
<strong>
|
|
69
|
-
<p>
|
|
88
|
+
<strong>{dictionary['stepThreeTitle']}</strong>
|
|
89
|
+
<p>{dictionary['stepThreeDescription']}</p>
|
|
70
90
|
</div>
|
|
71
91
|
</li>
|
|
72
92
|
</ol>
|
|
73
93
|
</aside>
|
|
74
94
|
</div>
|
|
75
95
|
<footer className="nova-launchpad__footer">
|
|
76
|
-
<span>
|
|
77
|
-
<nav className="nova-launchpad__socials" aria-label=
|
|
78
|
-
<a className="nova-launchpad__social-link" href="https://www.facebook.com/cbnventures" target="_blank" rel="noreferrer" aria-label=
|
|
96
|
+
<span>{dictionary['footerCredit']}</span>
|
|
97
|
+
<nav className="nova-launchpad__socials" aria-label={dictionary['socialLabel']}>
|
|
98
|
+
<a className="nova-launchpad__social-link" href="https://www.facebook.com/cbnventures" target="_blank" rel="noreferrer" aria-label={dictionary['facebook']}>
|
|
79
99
|
<svg className="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#facebook" /></svg>
|
|
80
100
|
</a>
|
|
81
|
-
<a className="nova-launchpad__social-link" href="https://x.com/cbnventures" target="_blank" rel="noreferrer" aria-label=
|
|
101
|
+
<a className="nova-launchpad__social-link" href="https://x.com/cbnventures" target="_blank" rel="noreferrer" aria-label={dictionary['x']}>
|
|
82
102
|
<svg className="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#x" /></svg>
|
|
83
103
|
</a>
|
|
84
|
-
<a className="nova-launchpad__social-link" href="https://www.youtube.com/@cbnventures" target="_blank" rel="noreferrer" aria-label=
|
|
104
|
+
<a className="nova-launchpad__social-link" href="https://www.youtube.com/@cbnventures" target="_blank" rel="noreferrer" aria-label={dictionary['youtube']}>
|
|
85
105
|
<svg className="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#youtube" /></svg>
|
|
86
106
|
</a>
|
|
87
|
-
<a className="nova-launchpad__social-link" href="https://www.instagram.com/cbnventures/" target="_blank" rel="noreferrer" aria-label=
|
|
107
|
+
<a className="nova-launchpad__social-link" href="https://www.instagram.com/cbnventures/" target="_blank" rel="noreferrer" aria-label={dictionary['instagram']}>
|
|
88
108
|
<svg className="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#instagram" /></svg>
|
|
89
109
|
</a>
|
|
90
|
-
<a className="nova-launchpad__social-link" href="https://github.com/cbnventures" target="_blank" rel="noreferrer" aria-label=
|
|
110
|
+
<a className="nova-launchpad__social-link" href="https://github.com/cbnventures" target="_blank" rel="noreferrer" aria-label={dictionary['github']}>
|
|
91
111
|
<svg className="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#github" /></svg>
|
|
92
112
|
</a>
|
|
93
|
-
<a className="nova-launchpad__social-link" href="https://play.google.com/store/apps/dev?id=6419450160526226105" target="_blank" rel="noreferrer" aria-label=
|
|
113
|
+
<a className="nova-launchpad__social-link" href="https://play.google.com/store/apps/dev?id=6419450160526226105" target="_blank" rel="noreferrer" aria-label={dictionary['googlePlay']}>
|
|
94
114
|
<svg className="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#google-play" /></svg>
|
|
95
115
|
</a>
|
|
96
|
-
<a className="nova-launchpad__social-link" href="https://www.linkedin.com/company/cbnventures/" target="_blank" rel="noreferrer" aria-label=
|
|
116
|
+
<a className="nova-launchpad__social-link" href="https://www.linkedin.com/company/cbnventures/" target="_blank" rel="noreferrer" aria-label={dictionary['linkedin']}>
|
|
97
117
|
<svg className="nova-launchpad__social-icon" aria-hidden="true"><use href="/nova-socials.svg#linkedin" /></svg>
|
|
98
118
|
</a>
|
|
99
119
|
</nav>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
I18n_Config_DefaultLocale,
|
|
3
|
+
I18n_Config_HasLocale_Locale,
|
|
4
|
+
I18n_Config_HasLocale_TypeGuard,
|
|
5
|
+
I18n_Config_Locales,
|
|
6
|
+
} from '../types/i18n/config.d.ts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Config - Default Locale.
|
|
10
|
+
*
|
|
11
|
+
* Keeps English available before consumers add translated dictionaries.
|
|
12
|
+
* Acts as the destination for requests without a supported locale prefix.
|
|
13
|
+
*
|
|
14
|
+
* @since 0.0.0
|
|
15
|
+
*/
|
|
16
|
+
export const defaultLocale: I18n_Config_DefaultLocale = 'en';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Config - Locales.
|
|
20
|
+
*
|
|
21
|
+
* Defines the locale routes generated by the application.
|
|
22
|
+
* Consumers extend this list alongside their server-side dictionaries.
|
|
23
|
+
*
|
|
24
|
+
* @since 0.0.0
|
|
25
|
+
*/
|
|
26
|
+
export const locales: I18n_Config_Locales = ['en'];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Config - Has Locale.
|
|
30
|
+
*
|
|
31
|
+
* Narrows an incoming route segment to a supported application locale.
|
|
32
|
+
* Keeps route validation synchronized with the configured locale list.
|
|
33
|
+
*
|
|
34
|
+
* @param {I18n_Config_HasLocale_Locale} locale - Locale.
|
|
35
|
+
*
|
|
36
|
+
* @returns {I18n_Config_HasLocale_TypeGuard}
|
|
37
|
+
*
|
|
38
|
+
* @since 0.0.0
|
|
39
|
+
*/
|
|
40
|
+
export function hasLocale(locale: I18n_Config_HasLocale_Locale): locale is I18n_Config_HasLocale_TypeGuard {
|
|
41
|
+
return locales.some((supportedLocale) => supportedLocale === locale);
|
|
42
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
defaultLocale,
|
|
5
|
+
locales,
|
|
6
|
+
} from './i18n/config';
|
|
7
|
+
|
|
8
|
+
import type {
|
|
9
|
+
Proxy_Config,
|
|
10
|
+
Proxy_LocalizeRequest_Pathname,
|
|
11
|
+
Proxy_LocalizeRequest_PathnameHasLocale,
|
|
12
|
+
Proxy_LocalizeRequest_Request,
|
|
13
|
+
Proxy_LocalizeRequest_Returns,
|
|
14
|
+
Proxy_LocalizeRequest_Url,
|
|
15
|
+
} from './types/proxy.d.ts';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Proxy - Config.
|
|
19
|
+
*
|
|
20
|
+
* Runs locale routing for application pages while leaving framework internals
|
|
21
|
+
* and static files untouched.
|
|
22
|
+
*
|
|
23
|
+
* @since 0.0.0
|
|
24
|
+
*/
|
|
25
|
+
export const config: Proxy_Config = {
|
|
26
|
+
matcher: ['/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt|.*\\..*).*)'],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Proxy - Localize Request.
|
|
31
|
+
*
|
|
32
|
+
* Keeps an existing supported locale route or redirects to the English route.
|
|
33
|
+
* Consumers can add browser-language negotiation when they add more locales.
|
|
34
|
+
*
|
|
35
|
+
* @param {Proxy_LocalizeRequest_Request} request - Request.
|
|
36
|
+
*
|
|
37
|
+
* @returns {Proxy_LocalizeRequest_Returns}
|
|
38
|
+
*
|
|
39
|
+
* @since 0.0.0
|
|
40
|
+
*/
|
|
41
|
+
function localizeRequest(request: Proxy_LocalizeRequest_Request): Proxy_LocalizeRequest_Returns {
|
|
42
|
+
const pathname: Proxy_LocalizeRequest_Pathname = request.nextUrl.pathname;
|
|
43
|
+
const pathnameHasLocale: Proxy_LocalizeRequest_PathnameHasLocale = locales.some((locale) => pathname === `/${locale}` || pathname.startsWith(`/${locale}/`));
|
|
44
|
+
|
|
45
|
+
if (pathnameHasLocale === true) {
|
|
46
|
+
return NextResponse.next();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const url: Proxy_LocalizeRequest_Url = request.nextUrl.clone();
|
|
50
|
+
|
|
51
|
+
url.pathname = `/${defaultLocale}${pathname}`;
|
|
52
|
+
|
|
53
|
+
return NextResponse.redirect(url);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default localizeRequest;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dictionaries.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.0.0
|
|
5
|
+
*/
|
|
6
|
+
export type App_Lang_Dictionaries_Dictionaries_Dictionary = Record<string, string>;
|
|
7
|
+
|
|
8
|
+
export type App_Lang_Dictionaries_Dictionaries_Loader_Returns = Promise<App_Lang_Dictionaries_Dictionaries_Dictionary>;
|
|
9
|
+
|
|
10
|
+
export type App_Lang_Dictionaries_Dictionaries_Loader = () => App_Lang_Dictionaries_Dictionaries_Loader_Returns;
|
|
11
|
+
|
|
12
|
+
export type App_Lang_Dictionaries_Dictionaries = Record<'en', App_Lang_Dictionaries_Dictionaries_Loader>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Dictionaries.
|
|
16
|
+
*
|
|
17
|
+
* @since 0.0.0
|
|
18
|
+
*/
|
|
19
|
+
export type App_Lang_Dictionaries_GetDictionary_Locale = keyof App_Lang_Dictionaries_Dictionaries;
|
|
20
|
+
|
|
21
|
+
export type App_Lang_Dictionaries_GetDictionary_Returns = Promise<App_Lang_Dictionaries_Dictionaries_Dictionary>;
|