Adding inlang paraglide js for i18n.

This commit is contained in:
Bradley Shellnut 2024-01-16 08:46:31 -08:00
parent 1b11815b02
commit 5241572b76
8 changed files with 774 additions and 3 deletions

5
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"recommendations": [
"inlang.vs-code-extension"
]
}

View file

@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "NODE_OPTIONS=\"--inspect\" vite dev --host",
"build": "vite build",
"build": "paraglide-js compile --project ./project.inlang && vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"test:ui": "svelte-kit sync && playwright test --ui",
@ -13,13 +13,16 @@
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"test:integration": "playwright test",
"test:unit": "vitest"
"test:unit": "vitest",
"postinstall": "paraglide-js compile --project ./project.inlang"
},
"devDependencies": {
"@iconify-icons/material-symbols": "^1.2.58",
"@iconify-icons/mdi": "^1.2.48",
"@iconify-icons/radix-icons": "^1.2.9",
"@iconify-icons/simple-icons": "^1.2.74",
"@inlang/paraglide-js": "1.2.0",
"@inlang/paraglide-js-adapter-vite": "^1.2.2",
"@melt-ui/pp": "^0.1.4",
"@playwright/test": "^1.40.1",
"@resvg/resvg-js": "^2.6.0",

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
7429e1a0928554a4e7f039079040878ef319a0166bed295bc9383189405b4b6c

View file

@ -0,0 +1,19 @@
{
"$schema": "https://inlang.com/schema/project-settings",
"sourceLanguageTag": "en",
"languageTags": [
"en"
],
"modules": [
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-valid-js-identifier@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@latest/dist/index.js"
],
"plugin.inlang.messageFormat": {
"pathPattern": "./messages/{languageTag}.json"
}
}

0
src/messages/en.json Normal file
View file

View file

@ -22,7 +22,8 @@ const config = {
kit: {
adapter: adapter(),
alias: {
$root: './src'
$root: './src',
$paraglide: './src/paraglide'
}
}
};

View file

@ -1,4 +1,5 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { paraglide } from '@inlang/paraglide-js-adapter-vite';
import fs from 'fs';
import type { UserConfig } from 'vite';
import { imagetools } from '@zerodevx/svelte-img/vite';
@ -6,6 +7,10 @@ import { imagetools } from '@zerodevx/svelte-img/vite';
const config: UserConfig = {
plugins: [
sveltekit(),
paraglide({
project: './project.inlang',
outdir: './src/paraglide'
}),
imagetools({
// By default, directives are `?width=480;1024;1920&format=avif;webp;jpg`
// Now we change it to generate 5 variants instead - `avif/jpg` formats at `640/1280` + LQIP (Now as:run)