Add i18n support #5

Closed
stne3960 wants to merge 13 commits from basic-scaffolding-frontend-lingui into basic-scaffolding-frontend
6 changed files with 1134 additions and 1130 deletions
Showing only changes of commit 52d5dcf91b - Show all commits

View File

@ -1,3 +0,0 @@
{
"plugins": ["@lingui/babel-plugin-lingui-macro"]
}

15
frontend/.swcrc Normal file
View File

@ -0,0 +1,15 @@
{
"$schema": "https://swc.rs/schema.json",
"jsc": {
"experimental": {
"plugins": [
[
"@lingui/swc-plugin",
{
// Additional Configuration
}
]
]
}
}
}

View File

@ -9,5 +9,4 @@ export default defineConfig({
include: ["src"], include: ["src"],
}, },
], ],
compileNamespace: "ts",
}); });

File diff suppressed because it is too large Load Diff

View File

@ -4,17 +4,15 @@
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "concurrently \"npm:dev:vite\" \"npm:i18n:watch\"", "dev": "vite",
"dev:vite": "vite", "build": "tsc -b && vite build",
"build": "lingui compile --typescript && tsc -b && vite build",
"lint": "eslint .", "lint": "eslint .",
"format": "prettier . --write", "format": "prettier . --write",
"update-api": "openapi-typescript http://localhost:8080/v3/api-docs --output src/lib/api.d.ts", "update-api": "openapi-typescript http://localhost:8080/v3/api-docs --output src/lib/api.d.ts",
"preview": "vite preview", "preview": "vite preview",
"extract": "lingui extract", "extract": "lingui extract",
"extract-clean": "lingui extract --clean", "extract-clean": "lingui extract --clean",
"compile": "lingui compile --typescript", "compile": "lingui compile --typescript"
stne3960 marked this conversation as resolved Outdated

Need instructions in the readme what these commands do and what the expected workflow is when adding/translating new content.

Need instructions in the readme what these commands do and what the expected workflow is when adding/translating new content.
"i18n:watch": "lingui compile --typescript --watch"
}, },
"dependencies": { "dependencies": {
"@lingui/react": "^5.3.0", "@lingui/react": "^5.3.0",
@ -25,13 +23,12 @@
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.21.0", "@eslint/js": "^9.21.0",
"@lingui/babel-plugin-lingui-macro": "^5.3.0",
"@lingui/cli": "^5.3.0", "@lingui/cli": "^5.3.0",
"@lingui/swc-plugin": "^5.5.1",
"@lingui/vite-plugin": "^5.3.0", "@lingui/vite-plugin": "^5.3.0",
"@types/react": "^19.0.10", "@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4", "@types/react-dom": "^19.0.4",
"@vitejs/plugin-react": "^4.3.4", "@vitejs/plugin-react-swc": "^3.8.0",
"concurrently": "^9.1.2",
"eslint": "^9.21.0", "eslint": "^9.21.0",
"eslint-config-prettier": "^10.1.1", "eslint-config-prettier": "^10.1.1",
"eslint-plugin-react-hooks": "^5.1.0", "eslint-plugin-react-hooks": "^5.1.0",
@ -42,5 +39,8 @@
"typescript": "~5.7.2", "typescript": "~5.7.2",
"typescript-eslint": "^8.24.1", "typescript-eslint": "^8.24.1",
"vite": "^6.2.0" "vite": "^6.2.0"
},
"overrides": {
"@swc/core": "1.3.56"
} }
} }

View File

@ -1,16 +1,11 @@
import { defineConfig } from "vite"; import { defineConfig } from "vite";
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react-swc";
import { lingui } from "@lingui/vite-plugin"; import { lingui } from "@lingui/vite-plugin";
export default defineConfig({ export default defineConfig({
build: {
target: "esnext",
},
plugins: [ plugins: [
react({ react({
babel: { plugins: [["@lingui/swc-plugin", {}]],
plugins: ["@lingui/babel-plugin-lingui-macro"],
},
}), }),
lingui(), lingui(),
], ],