updated i18n to 1.7.1

added extractRouteLangCode
This commit is contained in:
Nico 2023-05-18 19:46:56 +02:00
parent aa89b603dc
commit ad29621be0
3 changed files with 42 additions and 40 deletions

View File

@ -13,12 +13,12 @@
"i18n:sync": "astro-i18n sync"
},
"dependencies": {
"@astrojs/image": "0.16.7",
"@astrojs/image": "0.16.8",
"@astrojs/mdx": "^0.19.1",
"@astrojs/rss": "^2.4.1",
"@astrojs/sitemap": "^1.3.1",
"astro": "2.4.4",
"astro-i18n": "1.7.0"
"astro": "2.4.5",
"astro-i18n": "1.7.1"
},
"devDependencies": {
"autoprefixer": "^10.4.13",

View File

@ -2,11 +2,11 @@ lockfileVersion: '6.0'
dependencies:
'@astrojs/image':
specifier: 0.16.7
version: 0.16.7(astro@2.4.3)
specifier: 0.16.8
version: 0.16.8(astro@2.4.5)
'@astrojs/mdx':
specifier: ^0.19.1
version: 0.19.1(astro@2.4.3)(rollup@3.22.0)
version: 0.19.1(astro@2.4.5)(rollup@3.22.0)
'@astrojs/rss':
specifier: ^2.4.1
version: 2.4.1
@ -14,11 +14,11 @@ dependencies:
specifier: ^1.3.1
version: 1.3.1
astro:
specifier: 2.4.3
version: 2.4.3
specifier: 2.4.5
version: 2.4.5
astro-i18n:
specifier: 1.7.0
version: 1.7.0
specifier: 1.7.1
version: 1.7.1
devDependencies:
autoprefixer:
@ -46,17 +46,17 @@ packages:
resolution: {integrity: sha512-xoRp7JpiMZPK/beUcZEM5kM44Z/h20wwwQcl54duPqQMyySG9vZ5xMM6dYiQmn7b3XzpZs0cT6TRDoJJ5gwHAQ==}
dev: false
/@astrojs/image@0.16.7(astro@2.4.3):
resolution: {integrity: sha512-8X1DnMh3lUTA7BNt7dF0rfWTXNwvLoPWWXtLi+TdO3CW1SvdY9LJRuCEWwHfnKzcQ0EC2TfLwjukpbtJuCRxjw==}
/@astrojs/image@0.16.8(astro@2.4.5):
resolution: {integrity: sha512-ka18Y8HXllitE4TN66tmxqc1j+pgfqfq5i/D3I0QmmH2hFd7olFNVDrd15S4ZM1U5jxZORUv+PuJU0g8dZEjqQ==}
peerDependencies:
astro: ^2.3.4
astro: ^2.4.5
sharp: '>=0.31.0'
peerDependenciesMeta:
sharp:
optional: true
dependencies:
'@altano/tiny-async-pool': 1.0.2
astro: 2.4.3
astro: 2.4.5
http-cache-semantics: 4.1.1
image-size: 1.0.2
kleur: 4.1.5
@ -83,13 +83,13 @@ packages:
vscode-uri: 3.0.7
dev: false
/@astrojs/markdown-remark@2.2.0(astro@2.4.3):
/@astrojs/markdown-remark@2.2.0(astro@2.4.5):
resolution: {integrity: sha512-4M1+GzQwDqF0KfX9Ahug43b0avorcK+iTapEaVuNnaCUVS6sZKRkztT3g6hmXiFmGHSL8qYaS9IVEmKtP6hYmw==}
peerDependencies:
astro: ^2.4.0
dependencies:
'@astrojs/prism': 2.1.1
astro: 2.4.3
astro: 2.4.5
github-slugger: 1.5.0
import-meta-resolve: 2.2.2
rehype-raw: 6.1.1
@ -106,11 +106,11 @@ packages:
- supports-color
dev: false
/@astrojs/mdx@0.19.1(astro@2.4.3)(rollup@3.22.0):
/@astrojs/mdx@0.19.1(astro@2.4.5)(rollup@3.22.0):
resolution: {integrity: sha512-9GNNZbGT+lGvbRkQK/NaEJcnjj1T94/ne0KwPjJgNCBQrJuskX5IW1hKiE5bRSOFvkAOrBGneYKg0GXYArBOQQ==}
engines: {node: '>=16.12.0'}
dependencies:
'@astrojs/markdown-remark': 2.2.0(astro@2.4.3)
'@astrojs/markdown-remark': 2.2.0(astro@2.4.5)
'@astrojs/prism': 2.1.1
'@mdx-js/mdx': 2.3.0
'@mdx-js/rollup': 2.3.0(rollup@3.22.0)
@ -746,7 +746,7 @@ packages:
is-glob: 4.0.3
open: 9.1.0
picocolors: 1.0.0
tslib: 2.5.0
tslib: 2.5.1
dev: false
/@rollup/pluginutils@5.0.2(rollup@3.22.0):
@ -965,15 +965,15 @@ packages:
hasBin: true
dev: false
/astro-i18n@1.7.0:
resolution: {integrity: sha512-1oTzAg8sfoEUtsATbvpylaU1HYgRhjOMx7pFN+5GBDhJgUm8ETC0ncPNSOGiissRMjSAawQpDhYvzY8cLhxXsA==}
/astro-i18n@1.7.1:
resolution: {integrity: sha512-lqsGY6X1uL6yHRTAeDfc1lqX+ANiGJW6ePMqCwv276tUOugnJRw2X01MbiiiPpcGukpeZPDPe/OreoNWPBUhsQ==}
hasBin: true
dependencies:
get-file-exports: 1.2.1
dev: false
/astro@2.4.3:
resolution: {integrity: sha512-WU7sMkgFNQs4WZzEmpjOYZthcT8+LSmwIR0GvWzVYlb+dIMfFCQyg99LNHdhg/XZKi08ztaHmRf4ZBjJvZHsgA==}
/astro@2.4.5:
resolution: {integrity: sha512-osxLnuLXaOX0FjWOVQH8cmK4N/Gdj/ZdEkeyMJWsUss7xQU4Q64tAxB/dAv75f/XZiu+PprmndJkyQ4sYLOv1g==}
engines: {node: '>=16.12.0', npm: '>=6.14.0'}
hasBin: true
peerDependencies:
@ -984,7 +984,7 @@ packages:
dependencies:
'@astrojs/compiler': 1.4.2
'@astrojs/language-server': 1.0.5
'@astrojs/markdown-remark': 2.2.0(astro@2.4.3)
'@astrojs/markdown-remark': 2.2.0(astro@2.4.5)
'@astrojs/telemetry': 2.1.1
'@astrojs/webapi': 2.1.1
'@babel/core': 7.21.8
@ -1031,8 +1031,8 @@ packages:
typescript: 5.0.4
unist-util-visit: 4.1.2
vfile: 5.3.7
vite: 4.3.7
vitefu: 0.2.4(vite@4.3.7)
vite: 4.3.8
vitefu: 0.2.4(vite@4.3.8)
yargs-parser: 21.1.1
zod: 3.21.4
transitivePeerDependencies:
@ -1120,8 +1120,8 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
dependencies:
caniuse-lite: 1.0.30001488
electron-to-chromium: 1.4.397
caniuse-lite: 1.0.30001441
electron-to-chromium: 1.4.399
node-releases: 2.0.10
update-browserslist-db: 1.0.11(browserslist@4.21.4)
dev: true
@ -1132,7 +1132,7 @@ packages:
hasBin: true
dependencies:
caniuse-lite: 1.0.30001488
electron-to-chromium: 1.4.397
electron-to-chromium: 1.4.399
node-releases: 2.0.10
update-browserslist-db: 1.0.11(browserslist@4.21.5)
dev: false
@ -1169,6 +1169,7 @@ packages:
/caniuse-lite@1.0.30001488:
resolution: {integrity: sha512-NORIQuuL4xGpIy6iCCQGN4iFjlBXtfKWIenlUuyZJumLRIindLb7wXM+GO8erEhb7vXfcnf4BAg2PrSDN5TNLQ==}
dev: false
/ccount@2.0.1:
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
@ -1380,8 +1381,8 @@ packages:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
dev: false
/electron-to-chromium@1.4.397:
resolution: {integrity: sha512-jwnPxhh350Q/aMatQia31KAIQdhEsYS0fFZ0BQQlN9tfvOEwShu6ZNwI4kL/xBabjcB/nTy6lSt17kNIluJZ8Q==}
/electron-to-chromium@1.4.399:
resolution: {integrity: sha512-+V1aNvVgoWNWYIbMOiQ1n5fRIaY4SlQ/uRlrsCjLrUwr/3OvQgiX2f5vdav4oArVT9TnttJKcPCqjwPNyZqw/A==}
/emmet@2.4.4:
resolution: {integrity: sha512-v8Mwpjym55CS3EjJgiCLWUB3J2HSR93jhzXW325720u8KvYxdI2voYLstW3pHBxFz54H6jFjayR9G4LfTG0q+g==}
@ -3592,7 +3593,7 @@ packages:
engines: {node: ^14.18.0 || >=16.0.0}
dependencies:
'@pkgr/utils': 2.4.0
tslib: 2.5.0
tslib: 2.5.1
dev: false
/titleize@3.0.0:
@ -3631,8 +3632,8 @@ packages:
type-fest: 0.13.1
dev: false
/tslib@2.5.0:
resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==}
/tslib@2.5.1:
resolution: {integrity: sha512-KaI6gPil5m9vF7DKaoXxx1ia9fxS4qG5YveErRRVknPDXXriu5M8h48YRjB6h5ZUOKuAKlSJYb0GaDe8I39fRw==}
dev: false
/type-fest@0.13.1:
@ -3802,8 +3803,8 @@ packages:
vfile-message: 3.1.4
dev: false
/vite@4.3.7:
resolution: {integrity: sha512-MTIFpbIm9v7Hh5b0wSBgkcWzSBz7SAa6K/cBTwS4kUiQJfQLFlZZRJRQgqunCVzhTPCk674tW+0Qaqh3Q00dBg==}
/vite@4.3.8:
resolution: {integrity: sha512-uYB8PwN7hbMrf4j1xzGDk/lqjsZvCDbt/JC5dyfxc19Pg8kRm14LinK/uq+HSLNswZEoKmweGdtpbnxRtrAXiQ==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
peerDependencies:
@ -3834,7 +3835,7 @@ packages:
fsevents: 2.3.2
dev: false
/vitefu@0.2.4(vite@4.3.7):
/vitefu@0.2.4(vite@4.3.8):
resolution: {integrity: sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==}
peerDependencies:
vite: ^3.0.0 || ^4.0.0
@ -3842,7 +3843,7 @@ packages:
vite:
optional: true
dependencies:
vite: 4.3.7
vite: 4.3.8
dev: false
/vscode-css-languageservice@6.2.5:

View File

@ -1,5 +1,5 @@
---
import { astroI18n } from "astro-i18n";
import { astroI18n, extractRouteLangCode } from "astro-i18n";
astroI18n.init(Astro);
import { getCollection } from "astro:content";
@ -9,7 +9,8 @@ import BaseLayout from "../../layouts/BaseLayout.astro";
export async function getStaticPaths() {
const articles = await getCollection("articles", ({ data }) => {
return data.lang === astroI18n.langCode;
console.log(extractRouteLangCode(import.meta.url));
return data.lang === extractRouteLangCode(import.meta.url);
});
return articles.map((article) => ({
params: { slug: article.slug },