mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
Set up Paraglide for localization
This commit is contained in:
parent
7bf946deb2
commit
1928366081
13 changed files with 12385 additions and 16 deletions
23
.github/workflows/ninja_i18n.yml
vendored
Normal file
23
.github/workflows/ninja_i18n.yml
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
name: Ninja i18n action
|
||||
|
||||
on: pull_request_target
|
||||
|
||||
# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings
|
||||
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 - GitHub 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 }}
|
||||
|
||||
5
.vscode/extensions.json
vendored
5
.vscode/extensions.json
vendored
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"recommendations": ["astro-build.astro-vscode"],
|
||||
"recommendations": [
|
||||
"astro-build.astro-vscode",
|
||||
"inlang.vs-code-extension"
|
||||
],
|
||||
"unwantedRecommendations": []
|
||||
}
|
||||
|
|
@ -1,14 +1,32 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import tailwind from "@astrojs/tailwind";
|
||||
import node from "@astrojs/node";
|
||||
import { defineConfig } from 'astro/config'
|
||||
import tailwind from '@astrojs/tailwind'
|
||||
import node from '@astrojs/node'
|
||||
import paraglide from '@inlang/paraglide-astro'
|
||||
import auth from 'auth-astro'
|
||||
|
||||
import auth from "auth-astro";
|
||||
import { languageTags } from './project.inlang/settings.json'
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
integrations: [tailwind(), auth()],
|
||||
output: "server",
|
||||
i18n: {
|
||||
locales: languageTags,
|
||||
defaultLocale: 'en',
|
||||
routing: {
|
||||
prefixDefaultLocale: false,
|
||||
redirectToDefaultLocale: true
|
||||
}
|
||||
},
|
||||
integrations: [
|
||||
tailwind(),
|
||||
auth(),
|
||||
paraglide({
|
||||
// recommended settings
|
||||
project: './project.inlang',
|
||||
outdir: './src/paraglide' //where your files should be
|
||||
})
|
||||
],
|
||||
output: 'server',
|
||||
adapter: node({
|
||||
mode: "standalone"
|
||||
mode: 'standalone'
|
||||
})
|
||||
});
|
||||
})
|
||||
|
|
|
|||
3
messages/en.json
Normal file
3
messages/en.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format"
|
||||
}
|
||||
1093
package-lock.json
generated
1093
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -5,11 +5,13 @@
|
|||
"scripts": {
|
||||
"dev": "concurrently \"npm:gql:watch\" \"npm:astro:dev\"",
|
||||
"astro:dev": "astro dev",
|
||||
"build": "astro check && npm run gql:compile && astro build",
|
||||
"build": "npm run paraglide:compile && astro check && npm run gql:compile && astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro",
|
||||
"gql:compile": "graphql-codegen",
|
||||
"gql:watch": "graphql-codegen -w"
|
||||
"gql:watch": "graphql-codegen -w",
|
||||
"paraglide:compile": "paraglide-js compile --project ./project.inlang --outdir ./src\\paraglide",
|
||||
"postinstall": "npm run paraglide:compile"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.11.4",
|
||||
|
|
@ -22,6 +24,7 @@
|
|||
"@graphql-tools/load-files": "^7.0.0",
|
||||
"@graphql-tools/resolvers-composition": "^7.0.1",
|
||||
"@graphql-tools/schema": "^10.0.4",
|
||||
"@inlang/paraglide-astro": "^0.2.2",
|
||||
"astro": "^4.13.1",
|
||||
"auth-astro": "^4.1.2",
|
||||
"bcrypt": "^5.1.1",
|
||||
|
|
@ -32,6 +35,7 @@
|
|||
"tailwindcss": "^3.4.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@inlang/paraglide-js": "1.11.2",
|
||||
"@parcel/watcher": "^2.4.1",
|
||||
"@types/bcrypt": "^5.0.2",
|
||||
"@types/lodash": "^4.17.7",
|
||||
|
|
|
|||
11193
pnpm-lock.yaml
generated
Normal file
11193
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
1
project.inlang/.gitignore
vendored
Normal file
1
project.inlang/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
cache
|
||||
1
project.inlang/project_id
Normal file
1
project.inlang/project_id
Normal file
|
|
@ -0,0 +1 @@
|
|||
021513eea48bfa4e8387b34adaf7bdc8f8f2c6a7b8fa2a20bc5f8a2a424f5295
|
||||
17
project.inlang/settings.json
Normal file
17
project.inlang/settings.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"$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-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/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"
|
||||
}
|
||||
}
|
||||
11
src/app.d.ts
vendored
Normal file
11
src/app.d.ts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import type { ParaglideLocals } from "@inlang/paraglide-sveltekit"
|
||||
import type { AvailableLanguageTag } from "$lib/paraglide/runtime"
|
||||
|
||||
|
||||
declare global {
|
||||
namespace App {
|
||||
interface Locals {
|
||||
paraglide: ParaglideLocals<AvailableLanguageTag>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
import { languageTag } from '../paraglide/runtime'
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
<html lang='en'>
|
||||
<html lang={languageTag()} dir={Astro.locals.paraglide.dir}>
|
||||
<head>
|
||||
<meta charset='utf-8' />
|
||||
<link rel='icon' type='image/svg+xml' href='/favicon.svg' />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"extends": "astro/tsconfigs/strict",
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "Bundler",
|
||||
"allowJs": true,
|
||||
"baseUrl": "src",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue