diff --git a/astro-i18n.config.ts b/astro-i18n.config.ts new file mode 100644 index 0000000..2bac80a --- /dev/null +++ b/astro-i18n.config.ts @@ -0,0 +1,14 @@ +import { defineAstroI18nConfig } from "astro-i18n" + +export default defineAstroI18nConfig({ + primaryLocale: "ja", // default app locale + secondaryLocales: ['en'], // other supported locales + fallbackLocale: "ja", // fallback locale (on missing translation) + trailingSlash: "never", // "never" or "always" + run: "client+server", // "client+server" or "server" + showPrimaryLocale: false, // "/en/about" vs "/about" + translationLoadingRules: [], // per page group loading + translationDirectory: {}, // translation directory names + translations: {}, // { [translation_group1]: { [locale1]: {}, ... } } + routes: {}, // { [secondary_locale1]: { about: "about-translated", ... } } +}) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 53ad283..fe317d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@astrojs/tailwind": "^5.0.2", "astro": "^3.6.4", "astro-auto-import": "^0.4.1", + "astro-i18n": "^2.1.18", "date-fns": "^2.30.0", "date-fns-tz": "^2.0.0", "disqus-react": "^1.1.5", @@ -2235,6 +2236,17 @@ "undici-types": "~5.26.4" } }, + "node_modules/astro-i18n": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/astro-i18n/-/astro-i18n-2.1.18.tgz", + "integrity": "sha512-yuJnoZoPOhP62p4qBIPYqUuBX0qdQoaoxK7E96aQp2epQWhYQzwDbgOkf5qBTbxZlRvguVc0s3P+68wGQSTYXg==", + "bin": { + "astro-i18n": "dist/src/bin.cjs" + }, + "peerDependencies": { + "esbuild": "0.x" + } + }, "node_modules/astro/node_modules/@esbuild/android-arm": { "version": "0.18.20", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", diff --git a/package.json b/package.json index cc37fff..46da7ca 100755 --- a/package.json +++ b/package.json @@ -1,60 +1,65 @@ { - "name": "astroplate", - "version": "2.5.0", - "description": "Astro and Tailwindcss boilerplate", - "author": "zeon.studio", - "license": "MIT", - "packageManager": "yarn@1.22.19", - "scripts": { - "dev": "yarn generate-json && astro dev", - "build": "yarn generate-json && astro build", - "preview": "astro preview", - "format": "prettier -w ./src", - "generate-json": "node scripts/jsonGenerator.js", - "remove-darkmode": "node scripts/removeDarkmode.js && yarn format" - }, - "dependencies": { - "@astrojs/mdx": "^1.1.5", - "@astrojs/react": "^3.0.6", - "@astrojs/rss": "^3.0.0", - "@astrojs/sitemap": "^3.0.3", - "@astrojs/tailwind": "^5.0.2", - "astro": "^3.6.4", - "astro-auto-import": "^0.4.1", - "date-fns": "^2.30.0", - "date-fns-tz": "^2.0.0", - "disqus-react": "^1.1.5", - "github-slugger": "^2.0.0", - "gray-matter": "^4.0.3", - "marked": "^11.0.0", - "prettier-plugin-astro": "^0.12.2", - "prettier-plugin-tailwindcss": "^0.5.7", - "prop-types": "^15.8.1", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-icons": "^4.12.0", - "react-lite-youtube-embed": "^2.4.0", - "remark-collapse": "^0.1.2", - "remark-toc": "^9.0.0", - "sharp": "^0.33.0", - "swiper": "^11.0.5" - }, - "devDependencies": { - "@tailwindcss/forms": "^0.5.7", - "@tailwindcss/typography": "^0.5.10", - "@types/marked": "^5.0.2", - "@types/node": "20.10.2", - "@types/react": "18.2.41", - "@types/react-dom": "18.2.17", - "autoprefixer": "^10.4.16", - "eslint": "^8.55.0", - "postcss": "^8.4.32", - "prettier": "^3.1.0", - "prettier-plugin-astro": "^0.12.2", - "prettier-plugin-tailwindcss": "^0.5.7", - "sass": "^1.69.5", - "tailwindcss": "^3.3.5", - "tailwind-bootstrap-grid": "^5.1.0", - "typescript": "5.3.2" - } + "name": "astroplate", + "version": "2.5.0", + "description": "Astro and Tailwindcss boilerplate", + "author": "zeon.studio", + "license": "MIT", + "packageManager": "yarn@1.22.19", + "scripts": { + "dev": "yarn generate-json && astro dev", + "build": "yarn generate-json && astro build", + "preview": "astro preview", + "format": "prettier -w ./src", + "generate-json": "node scripts/jsonGenerator.js", + "remove-darkmode": "node scripts/removeDarkmode.js && yarn format", + "i18n:extract": "astro-i18n extract", + "i18n:generate:pages": "astro-i18n generate:pages --purge", + "i18n:generate:types": "astro-i18n generate:types", + "i18n:sync": "npm run i18n:generate:pages && npm run i18n:generate:types" + }, + "dependencies": { + "@astrojs/mdx": "^1.1.5", + "@astrojs/react": "^3.0.6", + "@astrojs/rss": "^3.0.0", + "@astrojs/sitemap": "^3.0.3", + "@astrojs/tailwind": "^5.0.2", + "astro": "^3.6.4", + "astro-auto-import": "^0.4.1", + "astro-i18n": "^2.1.18", + "date-fns": "^2.30.0", + "date-fns-tz": "^2.0.0", + "disqus-react": "^1.1.5", + "github-slugger": "^2.0.0", + "gray-matter": "^4.0.3", + "marked": "^11.0.0", + "prettier-plugin-astro": "^0.12.2", + "prettier-plugin-tailwindcss": "^0.5.7", + "prop-types": "^15.8.1", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-icons": "^4.12.0", + "react-lite-youtube-embed": "^2.4.0", + "remark-collapse": "^0.1.2", + "remark-toc": "^9.0.0", + "sharp": "^0.33.0", + "swiper": "^11.0.5" + }, + "devDependencies": { + "@tailwindcss/forms": "^0.5.7", + "@tailwindcss/typography": "^0.5.10", + "@types/marked": "^5.0.2", + "@types/node": "20.10.2", + "@types/react": "18.2.41", + "@types/react-dom": "18.2.17", + "autoprefixer": "^10.4.16", + "eslint": "^8.55.0", + "postcss": "^8.4.32", + "prettier": "^3.1.0", + "prettier-plugin-astro": "^0.12.2", + "prettier-plugin-tailwindcss": "^0.5.7", + "sass": "^1.69.5", + "tailwind-bootstrap-grid": "^5.1.0", + "tailwindcss": "^3.3.5", + "typescript": "5.3.2" + } } diff --git a/src/content/homepage/-index-en.md b/src/content/homepage/-index-en.md new file mode 100755 index 0000000..0c76445 --- /dev/null +++ b/src/content/homepage/-index-en.md @@ -0,0 +1,34 @@ +--- +# Banner +banner: + title: "Dig DAO: web3 Research Community" + content: "The purpose of our activities is to discuss, research, practice, and disclose the ecosystem of Web 3.0 and the environment that should be maintained in order for it to be used for the healthy development of society." + image: "/images/banner.png" + button: + enable: false + label: "Get Started For Free" + link: "https://github.com/zeon-studio/astroplate" + +# Features +features: + - title: "Who we are" + image: "/images/digdao-photo.jpg" + content: "Dig DAO is a community for research and development of web3, which was born out of the Digital Agency's Web3.0 Study Group." + button: + enable: false + label: "Get Started Now" + link: "#" + + - title: "Projects" + image: "/images/verifier.png" + content: "We organize a variety of research and development related to the development of web3." + bulletpoints: + - "DID/VC SBT project" + - "DAO research project" + - "Supporting digital public goods" + button: + enable: false + label: "Get Started Now" + link: "https://github.com/zeon-studio/astroplate" + +--- diff --git a/src/content/homepage/-index.md b/src/content/homepage/-index-ja.md similarity index 95% rename from src/content/homepage/-index.md rename to src/content/homepage/-index-ja.md index 3a86a04..77d02a6 100755 --- a/src/content/homepage/-index.md +++ b/src/content/homepage/-index-ja.md @@ -25,7 +25,7 @@ features: bulletpoints: - "DID/VC SBT プロジェクト" - "DAO リサーチプロジェクト" - - "デジタル公共資本基金" + - "デジタル公共材のサポート環境づくり" button: enable: false label: "Get Started Now" diff --git a/src/content/sections/call-to-action-en.md b/src/content/sections/call-to-action-en.md new file mode 100644 index 0000000..7e17e8a --- /dev/null +++ b/src/content/sections/call-to-action-en.md @@ -0,0 +1,10 @@ +--- +enable: true +title: "Dig DAO Bounenkai" +image: "/images/party.png" +description: "On December 26, let's review on this year together and prepare for the web3/DAO in 2024! We will hold a year-end party at Crypto Cafe & Bar in Ebisu." +button: + enable: true + label: "Join" + link: "https://lu.ma/zjbfz1ik" +--- diff --git a/src/content/sections/call-to-action.md b/src/content/sections/call-to-action-ja.md similarity index 100% rename from src/content/sections/call-to-action.md rename to src/content/sections/call-to-action-ja.md diff --git a/src/i18n/common/en.json b/src/i18n/common/en.json new file mode 100644 index 0000000..5f68857 --- /dev/null +++ b/src/i18n/common/en.json @@ -0,0 +1,6 @@ +{ + "your_common": "コモン", + "they": { + "can": "できる" + } +} \ No newline at end of file diff --git a/src/i18n/common/ja.json b/src/i18n/common/ja.json new file mode 100644 index 0000000..098ffde --- /dev/null +++ b/src/i18n/common/ja.json @@ -0,0 +1,6 @@ +{ + "your_common": "translations here", + "they": { + "can": "be nested" + } +} diff --git a/src/layouts/components/LanguageSwitcher.astro b/src/layouts/components/LanguageSwitcher.astro new file mode 100644 index 0000000..aab5a57 --- /dev/null +++ b/src/layouts/components/LanguageSwitcher.astro @@ -0,0 +1,30 @@ +--- +import { astroI18n } from "astro-i18n"; +--- + + + + diff --git a/src/layouts/components/pages/HomePage.astro b/src/layouts/components/pages/HomePage.astro new file mode 100644 index 0000000..04f837b --- /dev/null +++ b/src/layouts/components/pages/HomePage.astro @@ -0,0 +1,110 @@ +--- +import { astroI18n, t } from "astro-i18n"; + +import { markdownify } from "@/lib/utils/textConverter"; +import CallToAction from "@/partials/CallToAction.astro"; +import Testimonial from "@/partials/Testimonial.astro"; +import type { Button, Feature } from "@/types"; +import { Image } from "astro:assets"; +import { getEntry } from "astro:content"; +import { FaCheck } from "react-icons/fa/index.js"; + +console.log(); + +interface Homepage { + banner: { + title: string; + content: string; + image: string; + button: Button; + }; + features: Feature[]; +} + +const homepage = await getEntry("homepage", `-index-${astroI18n.locale}`); + +const testimonial = await getEntry("sections", "testimonial"); +const call_to_action = await getEntry( + "sections", + `call-to-action-${astroI18n.locale}`, +); +const { banner, features }: Homepage = homepage!.data; +--- + + +
+
+
+
+

+

+ { + banner.button.enable && ( + + {banner.button.label} + + ) + } +

+ { + banner.image && ( +
+ banner image +
+ ) + } +
+
+
+ + + +{ + features.map((feature, index: number) => ( +
+
+
+
+ {feature.title} +
+
+

+

+

    + {feature.bulletpoints && + feature.bulletpoints.map((bullet: string) => ( +
  • + + +
  • + ))} +
+ {feature.button.enable && ( + + {feature.button.label} + + )} +

+
+
+
+ )) +} + + + + diff --git a/src/layouts/partials/Header.astro b/src/layouts/partials/Header.astro index 1f70aad..1c2cef8 100755 --- a/src/layouts/partials/Header.astro +++ b/src/layouts/partials/Header.astro @@ -1,4 +1,6 @@ --- +import { astroI18n } from "astro-i18n"; +import LanguageSwitcher from "@/components/LanguageSwitcher.astro"; import Logo from "@/components/Logo.astro"; import ThemeSwitcher from "@/components/ThemeSwitcher.astro"; import config from "@/config/config.json"; @@ -20,10 +22,12 @@ export interface NavigationLink { const { main }: { main: NavigationLink[] } = menu; const { navigation_button, settings } = config; const { pathname } = Astro.url; +const langPrefix = + astroI18n.locale === astroI18n.primaryLocale ? "" : `/${astroI18n.locale}`; ---
-