Skip to content

Commit 469d9db

Browse files
authored
Merge pull request #14 from kyoto-tech/i18n
I18n
2 parents ba0689f + e9d6990 commit 469d9db

File tree

9 files changed

+237
-45
lines changed

9 files changed

+237
-45
lines changed

astro.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ export default defineConfig({
1111
site: "https://kyoto-tech.github.io",
1212
integrations: [react(), sitemap(), mdx()],
1313

14+
i18n: {
15+
locales: ["en", "ja"],
16+
defaultLocale: "en",
17+
},
18+
1419
vite: {
1520
plugins: [tailwindcss()]
1621
}

public/flags/GB.svg

Lines changed: 22 additions & 0 deletions
Loading

public/flags/JP.svg

Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
import { languages } from '../i18n/ui';
3+
import { getRelativeLocaleUrl } from 'astro:i18n';
4+
5+
const langsToFlags = {
6+
en: 'GB.svg',
7+
ja: 'JP.svg',
8+
};
9+
10+
const activeLang = Astro.currentLocale;
11+
const visibleLangs = Object.entries(languages).filter(([lang]) => lang !== activeLang);
12+
13+
---
14+
<ul class="absolute top-4 right-4 md:top-6 md:right-6 z-20 flex gap-2">
15+
{visibleLangs.map(([lang, label]) => (
16+
<li>
17+
<a
18+
href={getRelativeLocaleUrl(lang, "/")}
19+
class="block p-2 md:p-3 rounded-lg bg-white/20 backdrop-blur-sm hover:bg-white/30 transition-colors shadow-lg ring-1 ring-white/30"
20+
title={label}
21+
>
22+
<img src={`/flags/${langsToFlags[lang]}`} alt={label} width="24" height="16" class="w-6 h-4 md:w-8 md:h-5" />
23+
</a>
24+
</li>
25+
))}
26+
</ul>

src/i18n/ui.ts

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
export const languages = {
2+
en: "English",
3+
ja: "Japanese",
4+
};
5+
6+
export const defaultLang = "en";
7+
8+
export const ui = {
9+
en: {
10+
"home.header.tagline": "Kyoto Tech Meetup",
11+
"home.header.title": "Connect, learn, and build together in Japan's cultural heart",
12+
"home.header.subtitle": "Gatherings for developers, designers, researchers, and founders exploring technology in Kyoto.",
13+
"home.header.cta": "Join the next meetup",
14+
15+
"home.whyJoin.label": "Why Join?",
16+
"home.whyJoin.title": "Small, intentional gatherings",
17+
18+
"home.benefit1.title": "Conversation, not conferences",
19+
"home.benefit1.description": "Small, high-signal gatherings where people actually talk to each other about what they're building, learning, and struggling with. No stage, no slide decks, no pressure.",
20+
21+
"home.benefit2.title": "Community",
22+
"home.benefit2.description": "Meet a mix of locals and visitors: software engineers, founders, designers, researchers, and remote workers from all over the world. It's a uniquely international, high-signal environment.",
23+
24+
"home.benefit3.title": "Collaboration",
25+
"home.benefit3.description": "Use the meetup to find co-founders, collaborators, study buddies, or just people who care about the same weird tech rabbit holes you do.",
26+
27+
"home.whatsHappening.label": "What's happening?",
28+
"home.whatsHappening.title": "Two core sessions each month",
29+
30+
"home.activity1.title": "Morning Tech Coffee",
31+
"home.activity1.content1": "A relaxed, conversation-first meetup in central Kyoto.",
32+
"home.activity1.content2": "We grab coffee, grab a table, and talk about whatever people are building or exploring: AI workflows, indie apps, creative coding, career paths in Japan, or day-to-day life in Kyoto. No agenda, no presentations.",
33+
"home.activity1.content3": "It's simple, friendly, and a great way to start the day before work.",
34+
35+
"home.activity2.title": "Community Hack Day",
36+
"home.activity2.content1": "A collaborative working session where we ship projects.",
37+
"home.activity2.content2": "Bring an idea, help someone else, or join a team on something that interests you. Projects stay intentionally small and shippable, and everything lives openly in the [Kyoto Tech Meetup GitHub organization](https://github.com/kyoto-tech).",
38+
"home.activity2.content3": "It's creative, practical, and a great way to contribute to the local ecosystem.",
39+
40+
"home.whoComes.label": "Who Comes?",
41+
"home.whoComes.title": "People who like to build in public",
42+
"home.whoComes.intro": "You'll probably like it here if you are:",
43+
"home.whoComes.item1": "A software engineer or researcher working with web, AI, or creative tech",
44+
"home.whoComes.item2": "A founder or early-stage startup person",
45+
"home.whoComes.item3": "A designer, PM, or DX / DevRel person who likes talking product",
46+
"home.whoComes.item4": "A grad student or visiting researcher looking for a local tech community",
47+
"home.whoComes.item5": "A remote worker in Kyoto who misses nerding out with coworkers",
48+
49+
"home.languages.title": "Languages",
50+
"home.languages.description": "The meetup is English-friendly with a natural mix of English and Japanese. Come as you are; we'll make space.",
51+
52+
"home.locations.title": "Locations",
53+
"home.locations.description1": "We meet at cafés and shared spaces in central Kyoto.",
54+
"home.locations.description2": "Exact time and place are in each event invite and reminder email.",
55+
56+
"home.footer.copyright": "Kyoto Tech Meetup. Crafted by volunteers in Kyoto.",
57+
"home.footer.github": "GitHub",
58+
"home.footer.discord": "Discord",
59+
"home.footer.meetup": "Meetup",
60+
},
61+
ja: {
62+
"home.header.tagline": "Kyoto Tech Meetup",
63+
"home.header.title": "日本の文化都市・京都でつながり、学び、ものづくりをしよう",
64+
"home.header.subtitle": "京都でテクノロジーを探求するデベロッパー、デザイナー、研究者、創業者のための集まりです。",
65+
"home.header.cta": "次のミートアップに参加する",
66+
67+
"home.whyJoin.label": "参加する理由",
68+
"home.whyJoin.title": "小規模で意図のある集まり",
69+
70+
"home.benefit1.title": "話すための場、会議ではない",
71+
"home.benefit1.description": "小規模で密度の高い集まり。参加者が実際に、自分が作っているもの・学んでいること・悩んでいることについて話せる場所です。ステージもスライドもプレッシャーもありません。",
72+
73+
"home.benefit2.title": "コミュニティ",
74+
"home.benefit2.description": "地元の人も、海外からの訪問者も。ソフトウェアエンジニア、創業者、デザイナー、研究者、リモートワーカーなど、世界中から来た人たちと出会えます。国際色豊かで、高い情報密度の環境です。",
75+
76+
"home.benefit3.title": "コラボレーション",
77+
"home.benefit3.description": "共同創業者、協力者、勉強仲間を見つけたり、あなたと同じ“ちょっと変わった”技術の話題に興味を持つ仲間とつながることができます。",
78+
79+
"home.whatsHappening.label": "今やっていること",
80+
"home.whatsHappening.title": "月に2回のコアセッション",
81+
82+
"home.activity1.title": "Morning Tech Coffee",
83+
"home.activity1.content1": "京都中心部で行う、リラックスした「会話主体」のミートアップです。",
84+
"home.activity1.content2": "コーヒーを買って席につき、みんなが作っているもの・試していることについて気軽に話します。AIのワークフロー、個人開発、クリエイティブコーディング、日本でのキャリア、京都の日常など、テーマは自由。アジェンダもプレゼンもありません。",
85+
"home.activity1.content3": "シンプルでフレンドリー。仕事前に一日を気持ちよく始められます。",
86+
87+
"home.activity2.title": "Community Hack Day",
88+
"home.activity2.content1": "みんなでプロジェクトを“実際に”仕上げるコラボレーションデイです。",
89+
"home.activity2.content2": "アイデアを持ってくるのもよし、誰かを手伝うのもよし、興味のあるチームに参加するのもOK。プロジェクトは意図的に小さく、すぐに形にできる範囲で進めます。すべてはオープンに、[Kyoto Tech Meetup GitHub Organization](https://github.com/kyoto-tech) に公開されます。",
90+
"home.activity2.content3": "クリエイティブで実践的。京都のテックコミュニティに貢献する絶好の場です。",
91+
92+
"home.whoComes.label": "参加者",
93+
"home.whoComes.title": "“作っているところ”をオープンにする人たち",
94+
"home.whoComes.intro": "こんな人なら、きっと楽しめます:",
95+
96+
"home.whoComes.item1": "Web・AI・クリエイティブ系の技術に取り組むエンジニアや研究者",
97+
"home.whoComes.item2": "創業者やアーリーステージのスタートアップ関係者",
98+
"home.whoComes.item3": "プロダクトの話が好きなデザイナー、PM、DX/DevRel の方",
99+
"home.whoComes.item4": "京都に滞在中の大学院生や研究者で、地元のTechコミュニティを探している人",
100+
"home.whoComes.item5": "京都に住むリモートワーカーで、同僚と“技術の雑談”を恋しく思っている人",
101+
102+
"home.languages.title": "対応言語",
103+
"home.languages.description": "英語で気軽に参加できます。英語と日本語が自然に混ざるミートアップなので、そのままの自分でどうぞ。みんなで場をつくります。",
104+
105+
"home.locations.title": "開催場所",
106+
"home.locations.description1": "京都中心部のカフェやシェアスペースで集まっています。",
107+
"home.locations.description2": "具体的な場所と時間は、各イベントの案内メールやリマインダーでお知らせします。",
108+
109+
"home.footer.copyright": "Kyoto Tech Meetup — 京都在住のボランティアによるコミュニティ運営。",
110+
"home.footer.github": "GitHub",
111+
"home.footer.discord": "Discord",
112+
"home.footer.meetup": "Meetup"
113+
},
114+
} as const;

src/i18n/utils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { ui, defaultLang } from "./ui";
2+
3+
export function useTranslations(lang: keyof typeof ui) {
4+
return function t(key: keyof typeof ui[typeof defaultLang]) {
5+
return ui[lang][key] || ui[defaultLang][key];
6+
}
7+
}

src/layouts/Layout.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
---
22
import "../styles/global.css";
3+
const activeLang = Astro.currentLocale;
34
---
45

56
<!doctype html>
6-
<html lang="en">
7+
<html lang={activeLang}>
78
<head>
89
<meta charset="UTF-8" />
910
<meta name="viewport" content="width=device-width" />

0 commit comments

Comments
 (0)