You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -37,59 +40,67 @@ Say goodbye to setup headaches and hello to consistent code quality. Elevate you
37
40
-**Prettier Plugin Sort Imports**: Organize import declarations alphabetically within groups, which can help improve readability when working on larger projects.
38
41
-**Husky**: Ensure code quality and prevent bad commits with pre-commit hooks powered by Husky.
- Start the application using this Docker command:
42
-
43
-
docker-compose up
44
-
45
-
The command will:
46
-
1. Build the application container
47
-
2. Install all dependencies
48
-
3. Start the development server
49
-
4. Make the application available on localhost
50
-
```
51
-
52
-
- **Internationalization (i18n)**: Built-in support for multiple languages using next-intl, making it easy to create multilingual applications with locale-specific routing and translations.
53
-
## Getting Started
43
+
44
+
```bash
45
+
- Start the application using this Docker command:
46
+
47
+
docker-compose up
48
+
49
+
The command will:
50
+
1. Build the application container
51
+
2. Install all dependencies
52
+
3. Start the development server
53
+
4. Make the application available on localhost
54
+
```
55
+
56
+
-**Internationalization (i18n)**: Built-in support for multiple languages using next-intl, making it easy to create multilingual applications with locale-specific routing and translations.
NextJsLaunchpad comes with built-in internationalization support using next-intl. This integration provides:
62
69
63
70
- Route-based locale handling with `/[locale]/` directory structure
64
71
- Easy-to-use translation hooks with `useTranslations` in server and client components.
65
72
66
73
Translation files are located in:
74
+
67
75
```bash
68
76
content/
69
77
├── en.json
70
78
├── fr.json
71
79
└── [other-locales].json
72
-
```
80
+
```
81
+
73
82
#### How to add a new language support:
74
83
75
84
To add a new language, we have to add the language JSON file to the content directory, which is in the root directory, that is our first step.
76
85
77
86
After that, we have to add the newly added language to the locales array in the navigation.ts file. Below is the content of the navigation.ts file, where we need to add the newly added language to the locales array:
87
+
78
88
```bash
79
89
import {defineRouting} from 'next-intl/routing';
80
90
import {createNavigation} from 'next-intl/navigation';
81
91
82
92
export const routing = defineRouting({
83
93
// A list of all locales that are supported
84
94
locales: ['en', 'fr', 'newLanguage'], // Add the new language code here
To use strings from a language file in both **client and server** components, use the `useTranslations` hook.
@@ -101,6 +112,7 @@ To use strings from a language file in both **client and server** components, us
101
112
```javascript
102
113
import { useTranslations } from'next-intl';
103
114
```
115
+
104
116
2.**Initialize useTranslations with a section:**
105
117
```javascript
106
118
constt=useTranslations('Home');
@@ -110,7 +122,38 @@ To use strings from a language file in both **client and server** components, us
110
122
```javascript
111
123
<h1>{t('welcomeMessage')}</h1>
112
124
```
113
-
125
+
126
+
## Playwright E2E Testing
127
+
128
+
NextJsLaunchpad includes Playwright for robust end-to-end testing. This integration provides:
129
+
130
+
-**Headless and UI Testing**: Run tests in both headless mode for automation and UI mode for debugging.
131
+
-**Cross-Browser Compatibility**: Test on Chromium, Firefox, and WebKit.
132
+
-**API and Component Testing**: Supports API calls and frontend component interactions.
133
+
134
+
### Running Playwright Tests
135
+
136
+
To execute Playwright tests, use:
137
+
138
+
```shell
139
+
npm run playwright
140
+
```
141
+
142
+
### Playwright Configuration
143
+
144
+
Test settings are defined in:
145
+
146
+
```plaintext
147
+
/playwright.config.ts
148
+
```
149
+
150
+
### Test Files
151
+
152
+
Playwright tests are located in:
153
+
154
+
```plaintext
155
+
/__tests__/e2e/
156
+
```
114
157
115
158
<!-- Project should be public for the above command to work -->
116
159
@@ -263,4 +306,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
263
306
264
307
<!-- ALL-CONTRIBUTORS-LIST:END -->
265
308
266
-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
309
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
0 commit comments