Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6eff3f7

Browse files
authored
chore: bump dependencies to latest versions and adjust i18n implementation on pages (WICG#518)
1 parent096dcb6 commit6eff3f7

File tree

16 files changed

+356
-104
lines changed

16 files changed

+356
-104
lines changed

‎astro-i18next.config.mjs‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎astro.config.mjs‎

Lines changed: 57 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import{defineConfig}from'astro/config'
22
importstarlightfrom'@astrojs/starlight'
3-
importastroI18nextfrom'astro-i18next'
43
importreactfrom'@astrojs/react'
54
importstarlightLinksValidatorfrom'starlight-links-validator'
65

@@ -11,7 +10,7 @@ export default defineConfig({
1110
starlight({
1211
title:'Web Monetization',
1312
description:
14-
"Web Monetization introduces a new way for content owners and publishers to earn while allowing their audience to engage on their own terms.",
13+
'Web Monetization introduces a new way for content owners and publishers to earn while allowing their audience to engage on their own terms.',
1514
head:[
1615
{
1716
tag:'script',
@@ -50,9 +49,13 @@ export default defineConfig({
5049
Header:'./src/components/docs/Header.astro',
5150
PageSidebar:'./src/components/docs/PageSidebar.astro',
5251
},
53-
social:{
54-
github:'https://github.com/WICG/webmonetization',
55-
},
52+
social:[
53+
{
54+
icon:'github',
55+
label:'GitHub',
56+
href:'https://github.com/WICG/webmonetization',
57+
},
58+
],
5659
sidebar:[
5760
{
5861
label:'Overview',
@@ -80,18 +83,18 @@ export default defineConfig({
8083
label:'For content owners',
8184
collapsed:true,
8285
items:[
83-
{
84-
label:'Overview',
85-
link:'/developers/overview',
86-
},
87-
{
88-
label:'Get started',
89-
link:'/developers/get-started',
90-
},
91-
{
92-
label:'Learn about receiving payments',
93-
link:'/developers/about-receiving',
94-
},
86+
{
87+
label:'Overview',
88+
link:'/developers/overview',
89+
},
90+
{
91+
label:'Get started',
92+
link:'/developers/get-started',
93+
},
94+
{
95+
label:'Learn about receiving payments',
96+
link:'/developers/about-receiving',
97+
},
9598
],
9699
},
97100
{
@@ -104,7 +107,7 @@ export default defineConfig({
104107
items:[
105108
{
106109
label:'Webpage (HTML)',
107-
link:'/developers/link-element'
110+
link:'/developers/link-element',
108111
},
109112
{
110113
label:'Feed (RSS, Atom, JSON Feed)',
@@ -211,7 +214,7 @@ export default defineConfig({
211214
{
212215
label:'Web Monetization Specification',
213216
link:'https://webmonetization.org/specification/',
214-
attrs:{
217+
attrs:{
215218
target:'_blank',
216219
rel:'noopener noreferrer',
217220
'data-icon':'external',
@@ -234,7 +237,7 @@ export default defineConfig({
234237
{
235238
label:'Publisher tools',
236239
link:'https://webmonetization.org/tools/',
237-
attrs:{
240+
attrs:{
238241
target:'_blank',
239242
rel:'noopener noreferrer',
240243
'data-icon':'external',
@@ -249,38 +252,42 @@ export default defineConfig({
249252
],
250253
}),
251254
react(),
252-
astroI18next(),
253255
],
254256
redirects:{
255-
"/link-tag":"/tools/link-tag",
256-
"/prob-revshare":"/tools/prob-revshare",
257-
"/docs/api":"/developers/interfaces",
258-
"/docs/explainer":"/docs",
259-
"/docs/intro/sending-payments":"/supporters/about-sending",
260-
"/docs/intro/receiving-payments":"/developers/about-receiving",
261-
"/docs/intro/web-monetization-flow":"/docs",
262-
"/docs/intro/web-monetization-extension":"/supporters/get-started",
263-
"/docs/references/html":"/developers/link-element",
264-
"/docs/references/html-link-rel-monetization":"/developers/link-element",
265-
"/docs/references/rss-atom-jsonfeed":"/developers/rss-atom-jsonfeed",
266-
"/docs/references/activitystreams":"/developers/activity-streams",
267-
"/docs/references/onmonetization":"/developers/interfaces",
268-
"/docs/references/monetizationevent":"/developers/interfaces",
269-
"/docs/references/attributes/amountsent":"/developers/events#amountsent",
270-
"/docs/references/attributes/incomingpayment":"/developers/events#incomingpayment",
271-
"/docs/references/attributes/paymentpointer":"/developers/events#paymentpointer",
272-
"/docs/references/csp-monetization-src":"/developers/csp",
273-
"/docs/references/permissions-policy-monetization":"/developers/permissions-policy",
274-
"/docs/references/deprecations":"/docs",
275-
"/docs/guides/monetize-page":"/developers/get-started",
276-
"/docs/guides/remove-ads":"/tutorials/remove-content",
277-
"/docs/guides/provide-exclusive-content":"/tutorials/show-content",
278-
"/docs/guides/set-up-probabilistic-revenue-sharing":"/tutorials/revenue-sharing",
279-
"/docs/guides/add-a-streaming-payments-counter":"/tutorials/contribution-counter",
280-
"/docs/resources/glossary":"/resources/glossary",
281-
"/docs/resources/libraries":"/developers/libraries",
282-
"/docs/resources/op-wallets":"/wallets",
283-
"/docs/resources/get-involved":"/resources/get-involved",
257+
'/link-tag':'/tools/link-tag',
258+
'/prob-revshare':'/tools/prob-revshare',
259+
'/docs/api':'/developers/interfaces',
260+
'/docs/explainer':'/docs',
261+
'/docs/intro/sending-payments':'/supporters/about-sending',
262+
'/docs/intro/receiving-payments':'/developers/about-receiving',
263+
'/docs/intro/web-monetization-flow':'/docs',
264+
'/docs/intro/web-monetization-extension':'/supporters/get-started',
265+
'/docs/references/html':'/developers/link-element',
266+
'/docs/references/html-link-rel-monetization':'/developers/link-element',
267+
'/docs/references/rss-atom-jsonfeed':'/developers/rss-atom-jsonfeed',
268+
'/docs/references/activitystreams':'/developers/activity-streams',
269+
'/docs/references/onmonetization':'/developers/interfaces',
270+
'/docs/references/monetizationevent':'/developers/interfaces',
271+
'/docs/references/attributes/amountsent':'/developers/events#amountsent',
272+
'/docs/references/attributes/incomingpayment':
273+
'/developers/events#incomingpayment',
274+
'/docs/references/attributes/paymentpointer':
275+
'/developers/events#paymentpointer',
276+
'/docs/references/csp-monetization-src':'/developers/csp',
277+
'/docs/references/permissions-policy-monetization':
278+
'/developers/permissions-policy',
279+
'/docs/references/deprecations':'/docs',
280+
'/docs/guides/monetize-page':'/developers/get-started',
281+
'/docs/guides/remove-ads':'/tutorials/remove-content',
282+
'/docs/guides/provide-exclusive-content':'/tutorials/show-content',
283+
'/docs/guides/set-up-probabilistic-revenue-sharing':
284+
'/tutorials/revenue-sharing',
285+
'/docs/guides/add-a-streaming-payments-counter':
286+
'/tutorials/contribution-counter',
287+
'/docs/resources/glossary':'/resources/glossary',
288+
'/docs/resources/libraries':'/developers/libraries',
289+
'/docs/resources/op-wallets':'/wallets',
290+
'/docs/resources/get-involved':'/resources/get-involved',
284291
},
285292
server:{
286293
port:1100,

‎package.json‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,20 @@
88
"astro":"astro"
99
},
1010
"dependencies": {
11-
"@astrojs/react":"^4.1.5",
12-
"@astrojs/starlight":"^0.31.1",
13-
"@interledger/docs-design-system":"^0.6.1",
14-
"@types/react":"^19.0.7",
15-
"@types/react-dom":"^19.0.3",
16-
"astro":"5.1.7",
17-
"astro-i18next":"^1.0.0-beta.21",
18-
"prettier":"^3.4.2",
11+
"@astrojs/react":"^4.2.3",
12+
"@astrojs/starlight":"^0.33.0",
13+
"@interledger/docs-design-system":"^0.6.2",
14+
"@types/react":"^19.1.0",
15+
"@types/react-dom":"^19.1.1",
16+
"astro":"5.6.1",
17+
"prettier":"^3.5.3",
1918
"prism-react-renderer":"^2.4.1",
20-
"react":"^19.0.0",
21-
"react-dom":"^19.0.0",
19+
"react":"^19.1.0",
20+
"react-dom":"^19.1.0",
2221
"react-minimal-pie-chart":"^9.1.0",
2322
"remark-mermaidjs":"^7.0.0",
24-
"respec":"^35.2.2",
25-
"sharp":"^0.33.5",
26-
"starlight-links-validator":"^0.14.1"
23+
"respec":"^35.3.0",
24+
"sharp":"^0.34.1",
25+
"starlight-links-validator":"^0.15.0"
2726
}
2827
}

‎src/components/pages/TopNav.astro‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
---
2+
import {getLangFromUrl,useTranslations }from'../../i18n/utils';
3+
4+
const lang=getLangFromUrl(Astro.url);
5+
const t=useTranslations(lang);
26
---
37
<header>
48
<navclass="site-nav">
5-
<ahref="/"class="site-title">
9+
<ahref={`/${lang}/`}class="site-title">
610
<imgsrc="/img/wm-logo.svg"alt="Web Monetization logo">
711
<span>Web Monetization</span>
812
</a>
@@ -15,8 +19,8 @@
1519
</div>
1620
</button>
1721
<ulid="navMenu"class="nav-menu collapsed">
18-
<liclass="nav-link__docs"><ahref="/docs"data-umami-event="Landing page - WebMo docs">Documentation</a></li>
19-
<liclass="nav-link__docs"><ahref="/specification"data-umami-event="Landing page - WebMo specs">Specification</a></li>
22+
<liclass="nav-link__docs"><ahref="/docs"data-umami-event="Landing page - WebMo docs">{t('nav.documentation')}</a></li>
23+
<liclass="nav-link__docs"><ahref="/specification"data-umami-event="Landing page - WebMo specs">{t('nav.specification')}</a></li>
2024
<liclass="nav-link__github"><ahref="https://github.com/WICG/webmonetization/"><imgsrc="/img/icon-github.svg"alt="Link to GitHub repository"></a></li>
2125
</ul>
2226
</nav>

‎src/i18n/ui.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
exportconstshowDefaultLang=false
2+
exportconstlanguages={
3+
en:'English',
4+
es:'Español',
5+
}
6+
7+
exportconstdefaultLang='en'
8+
9+
exportconstui={
10+
en:{
11+
'site.title':'Web Monetization',
12+
'site.description':
13+
'The Web Monetization API allows websites to automatically and passively receive payments from Web Monetization-enabled visitors.',
14+
'nav.documentation':'Documentation',
15+
'nav.specification':'Specification',
16+
},
17+
es:{
18+
'site.title':'Web Monetization',
19+
'site.description':
20+
'The Web Monetization API allows websites to automatically and passively receive payments from Web Monetization-enabled visitors.',
21+
'nav.documentation':'Documentación',
22+
'nav.specification':'Especificación',
23+
},
24+
}asconst

‎src/i18n/utils.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import{ui,defaultLang}from'./ui'
2+
3+
exportfunctiongetLangFromUrl(url:URL){
4+
const[,lang]=url.pathname.split('/')
5+
if(langinui)returnlangaskeyoftypeofui
6+
returndefaultLang
7+
}
8+
9+
exportfunctionuseTranslations(lang:keyoftypeofui){
10+
returnfunctiont(key:keyof(typeofui)[typeofdefaultLang]){
11+
returnui[lang][key]||ui[defaultLang][key]
12+
}
13+
}

‎src/layouts/Base.astro‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
importi18next, {t,changeLanguage }from"i18next";
2+
import{getLangFromUrl,useTranslations }from'../i18n/utils';
33
importTopNavfrom"../components/pages/TopNav.astro";
44
importFooterfrom"../components/pages/Footer.astro";
55
import'/node_modules/@interledger/docs-design-system/src/styles/teal-theme.css';
@@ -12,11 +12,12 @@ interface Props {
1212
hasFooter?:boolean;
1313
}
1414
15+
const lang=getLangFromUrl(Astro.url);
16+
const t=useTranslations(lang);
1517
const canonicalURL=newURL(Astro.url.pathname,Astro.site);
1618
const { title=t("site.title"), description=t("site.description"), image='/img/wm-social.png', hasFooter=true }=Astro.props;
17-
changeLanguage("en");
1819
---
19-
<htmllang={i18next.language}data-theme="light">
20+
<htmllang={lang}data-theme="light">
2021
<metacharset="utf-8" />
2122
<metaname="viewport"content="width=device-width,initial-scale=1" />
2223
<linkrel="icon"type="image/svg+xml"href="/favicon.svg" />

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp