Skip to content

Commit

Permalink
feat: add i18n boilerplate (#102)
Browse files Browse the repository at this point in the history
* feat(i18n): set up Paraglide and extract messages

* chore(i18n): extract strings from homepage

* feat(i18n): add language switcher if multiple languages are present

* fix(i18n): ensure paraglide compiler runs after installation

* ci: fix playwright action

* fix: remove paraglide from the server

* feat: add another language as a example

---------

Co-authored-by: Michał <[email protected]>
  • Loading branch information
LorisSigrist and Skolaczk authored May 27, 2024
1 parent fa1f995 commit 2af1c69
Show file tree
Hide file tree
Showing 25 changed files with 8,675 additions and 124 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Checks if all Translations are present & valid
name: Ninja i18n action

on: pull_request_target

permissions:
pull-requests: write # Necessary to comment on PRs
issues: read # Necessary to read issue comments
contents: read # Necessary to access the repo content

jobs:
ninja-i18n:
name: Ninja - i18n Lint Action
runs-on: ubuntu-latest

steps:
- name: Run Ninja i18n
# @main ensures that the latest version of the action is used
uses: opral/ninja-i18n-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Install dependencies
run: npm ci
run: npm i
- name: Install playwright browsers
run: npx playwright install --with-deps
- name: Run tests
Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"inlang.vs-code-extension"
]
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
- 🤖 Github actions - Lint your code on PR
- ⚙️ T3-env - Manage your environment variables
- 💯 Perfect Lighthouse score
- 🌐 I18n with Paraglide

## 🚀 Deployment
Easily deploy your Next.js app with <a href="https://vercel.com/">Vercel</a> by clicking the button below:
Expand Down Expand Up @@ -101,6 +102,8 @@ and open http://localhost:3000/ to see this app.
├── lib # Functions and utilities
├── styles # Styles folder
├── types # Type definitions
├── messages # Messages for i18n
├── paraglide # (generated) compiled i18n messages
└── env.mjs # Env variables config file
```

Expand Down
9 changes: 8 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { paraglide } = require('@inlang/paraglide-next/plugin');
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
Expand All @@ -10,4 +11,10 @@ const nextConfig = {
},
};

module.exports = nextConfig;
module.exports = paraglide({
paraglide: {
project: './project.inlang',
outdir: './src/paraglide',
},
...nextConfig,
});
Loading

0 comments on commit 2af1c69

Please sign in to comment.