diff --git a/astro.config.mjs b/astro.config.mjs index 1ebbdfc..83ad662 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -16,6 +16,12 @@ export default defineConfig({ starlight({ title: 'Xahau Docs', description: 'Documentation for the Xahau blockchain', + defaultLocale: 'root', + locales: { + root: { label: 'English', lang: 'en' }, + es: { label: 'Español', lang: 'es' }, + ja: { label: '日本語', lang: 'ja' }, + }, tableOfContents: { minHeadingLevel: 1, maxHeadingLevel: 3, @@ -69,30 +75,48 @@ export default defineConfig({ sidebar: [ { label: 'Get started', + translations: { es: 'Primeros pasos', ja: 'はじめる' }, items: ['docs', 'docs/what-is-different'], }, { label: 'Features', + translations: { es: 'Características', ja: '機能' }, items: [ 'docs/features/public-nodes-rpc', 'docs/features/amendments', { label: 'Transaction Signing', + translations: { + es: 'Firma de Transacciones', + ja: 'トランザクション署名', + }, autogenerate: { directory: 'docs/features/transaction-signing' }, collapsed: true, }, { label: 'Developer Tooling', + translations: { + es: 'Herramientas para Desarrolladores', + ja: '開発者ツール', + }, autogenerate: { directory: 'docs/features/developer-tooling' }, collapsed: true, }, { label: 'HTTP / WebSocket APIs', + translations: { + es: 'APIs HTTP / WebSocket', + ja: 'HTTP / WebSocket API', + }, autogenerate: { directory: 'docs/features/http-websocket-apis' }, collapsed: true, }, { label: 'Network Features', + translations: { + es: 'Funcionalidades de Red', + ja: 'ネットワーク機能', + }, autogenerate: { directory: 'docs/features/network-features' }, collapsed: true, }, @@ -105,14 +129,23 @@ export default defineConfig({ }, { label: 'Protocol Reference', + translations: { + es: 'Referencia del Protocolo', + ja: 'プロトコルリファレンス', + }, items: [ { label: 'Transactions', + translations: { es: 'Transacciones', ja: 'トランザクション' }, collapsed: true, items: [ 'docs/protocol-reference/transactions', { label: 'Transaction Types', + translations: { + es: 'Tipos de Transacción', + ja: 'トランザクションタイプ', + }, autogenerate: { directory: 'docs/protocol-reference/transactions/transaction-types', @@ -121,6 +154,10 @@ export default defineConfig({ }, { label: 'Pseudo Transaction Types', + translations: { + es: 'Tipos de Pseudotransacción', + ja: '擬似トランザクションタイプ', + }, autogenerate: { directory: 'docs/protocol-reference/transactions/pseudo-transaction-types', @@ -129,6 +166,10 @@ export default defineConfig({ }, { label: 'Transaction Results', + translations: { + es: 'Resultados de Transacción', + ja: 'トランザクション結果', + }, autogenerate: { directory: 'docs/protocol-reference/transactions/transaction-results', @@ -141,11 +182,16 @@ export default defineConfig({ }, { label: 'Ledger Data', + translations: { es: 'Datos del Ledger', ja: 'レジャーデータ' }, collapsed: true, items: [ 'docs/protocol-reference/ledger-data', { label: 'Ledger Objects Types', + translations: { + es: 'Tipos de Objetos del Ledger', + ja: 'レジャーオブジェクトタイプ', + }, autogenerate: { directory: 'docs/protocol-reference/ledger-data/ledger-objects-types', @@ -158,6 +204,7 @@ export default defineConfig({ }, { label: 'Data Types', + translations: { es: 'Tipos de Datos', ja: 'データ型' }, collapsed: true, items: [ 'docs/protocol-reference/data-types', @@ -174,6 +221,7 @@ export default defineConfig({ 'docs/hooks', { label: 'Concepts', + translations: { es: 'Conceptos', ja: 'コンセプト' }, collapsed: true, items: [ 'docs/hooks/concepts/introduction', @@ -201,15 +249,21 @@ export default defineConfig({ }, { label: 'Functions', + translations: { es: 'Funciones', ja: '関数' }, collapsed: true, items: [ { label: 'Overview', + translations: { es: 'Descripción General', ja: '概要' }, collapsed: true, autogenerate: { directory: 'docs/hooks/functions/overview' }, }, { label: 'Developer Defined', + translations: { + es: 'Definidas por el Desarrollador', + ja: '開発者定義', + }, collapsed: true, autogenerate: { directory: 'docs/hooks/functions/developer-defined', @@ -222,11 +276,16 @@ export default defineConfig({ }, { label: 'Utilities', + translations: { es: 'Utilidades', ja: 'ユーティリティ' }, collapsed: true, autogenerate: { directory: 'docs/hooks/functions/utilities' }, }, { label: 'Serialization', + translations: { + es: 'Serialización', + ja: 'シリアライゼーション', + }, collapsed: true, autogenerate: { directory: 'docs/hooks/functions/serialization', @@ -234,6 +293,10 @@ export default defineConfig({ }, { label: 'Emitted Transaction', + translations: { + es: 'Transacción Emitida', + ja: '発行トランザクション', + }, collapsed: true, autogenerate: { directory: 'docs/hooks/functions/emitted-transaction', @@ -251,6 +314,10 @@ export default defineConfig({ }, { label: 'Hook Context', + translations: { + es: 'Contexto del Hook', + ja: 'フックコンテキスト', + }, collapsed: true, autogenerate: { directory: 'docs/hooks/functions/hook-context', @@ -263,11 +330,16 @@ export default defineConfig({ }, { label: 'State', + translations: { es: 'Estado', ja: '状態' }, collapsed: true, autogenerate: { directory: 'docs/hooks/functions/state' }, }, { label: 'Trace (Debug)', + translations: { + es: 'Traza (Debug)', + ja: 'トレース(デバッグ)', + }, collapsed: true, autogenerate: { directory: 'docs/hooks/functions/trace-debug', @@ -275,6 +347,10 @@ export default defineConfig({ }, { label: 'Originating Transaction', + translations: { + es: 'Transacción de Origen', + ja: '発信トランザクション', + }, collapsed: true, autogenerate: { directory: 'docs/hooks/functions/originating-transaction', @@ -297,6 +373,7 @@ export default defineConfig({ }, { label: 'Compliance', + translations: { es: 'Cumplimiento', ja: 'コンプライアンス' }, items: [ 'docs/compliance/security-audit', 'docs/compliance/responsible-disclosure', @@ -304,6 +381,7 @@ export default defineConfig({ }, { label: 'Infrastructure', + translations: { es: 'Infraestructura', ja: 'インフラストラクチャ' }, items: [ 'docs/infrastructure/system-requirements', 'docs/infrastructure/installing-xahaud', @@ -314,6 +392,10 @@ export default defineConfig({ 'docs/infrastructure/advanced-configuration', { label: 'Build xahaud (Advanced)', + translations: { + es: 'Compilar xahaud (Avanzado)', + ja: 'xahaudをビルド(上級)', + }, collapsed: true, items: [ 'docs/infrastructure/build-xahaud', @@ -325,10 +407,12 @@ export default defineConfig({ }, { label: 'Resources', + translations: { es: 'Recursos', ja: 'リソース' }, items: ['docs/resources/whitepaper', 'docs/resources/media-kit'], }, { label: 'Support', + translations: { es: 'Soporte', ja: 'サポート' }, autogenerate: { directory: 'docs/support' }, }, ], diff --git a/src/CookieConsentConfig.ts b/src/CookieConsentConfig.ts index 6c5d61b..fd83f84 100644 --- a/src/CookieConsentConfig.ts +++ b/src/CookieConsentConfig.ts @@ -1,79 +1,77 @@ +import { getRelativeLocaleUrl } from 'astro:i18n' import type { CookieConsentConfig } from 'vanilla-cookieconsent' -export const config: CookieConsentConfig = { - guiOptions: { - consentModal: { - layout: 'box', - position: 'bottom left', - equalWeightButtons: true, - flipButtons: false, +export function createCookieConsentConfig(locale: string): CookieConsentConfig { + const privacyPolicyHref = getRelativeLocaleUrl(locale, '/privacy-policy') + + return { + guiOptions: { + consentModal: { + layout: 'box', + position: 'bottom left', + equalWeightButtons: true, + flipButtons: false, + }, }, - preferencesModal: { - layout: 'box', - position: 'right', - equalWeightButtons: true, - flipButtons: false, + categories: { + necessary: { + readOnly: true, + }, + functionality: { + enabled: true, + }, + analytics: { + enabled: true, + }, }, - }, - categories: { - necessary: { - readOnly: true, - }, - functionality: { - enabled: true, - }, - analytics: { - enabled: true, - }, - }, - language: { - default: 'en', - translations: { - en: { - consentModal: { - title: 'Select your cookie preferences', - description: - 'We use cookies to ensure you get the best experience on our website.', - acceptAllBtn: 'Accept all', - acceptNecessaryBtn: 'Reject all', - showPreferencesBtn: 'Manage preferences', - footer: 'Privacy Policy', - }, - preferencesModal: { - title: 'Consent Preferences Center', - acceptAllBtn: 'Accept all', - acceptNecessaryBtn: 'Reject all', - savePreferencesBtn: 'Save preferences', - closeIconLabel: 'Close modal', - serviceCounterLabel: 'Service|Services', - sections: [ - { - title: - 'Strictly Necessary Cookies Always Enabled', - description: - 'Some cookies are essential in order to use the website and use some of its features.', - linkedCategory: 'necessary', - }, - { - title: 'Functionality Cookies', - description: - 'These cookies are used to enhance the performance and functionality of the website but are non-essential to their use. However, without these cookies, certain functionality (like videos) may become unavailable.', - linkedCategory: 'functionality', - }, - { - title: 'Analytics Cookies', - description: - 'We use analytics cookies to understand how you use our website so we can improve it.', - linkedCategory: 'analytics', - }, - { - title: 'More information', - description: - 'For any query in relation to the policy on cookies and your choices, please refer to the Privacy Policy.', - }, - ], + language: { + default: 'en', + translations: { + en: { + consentModal: { + title: 'Select your cookie preferences', + description: + 'We use cookies to ensure you get the best experience on our website.', + acceptAllBtn: 'Accept all', + acceptNecessaryBtn: 'Reject all', + showPreferencesBtn: 'Manage preferences', + footer: `Privacy Policy`, + }, + preferencesModal: { + title: 'Consent Preferences Center', + acceptAllBtn: 'Accept all', + acceptNecessaryBtn: 'Reject all', + savePreferencesBtn: 'Save preferences', + closeIconLabel: 'Close modal', + serviceCounterLabel: 'Service|Services', + sections: [ + { + title: + 'Strictly Necessary Cookies Always Enabled', + description: + 'Some cookies are essential in order to use the website and use some of its features.', + linkedCategory: 'necessary', + }, + { + title: 'Functionality Cookies', + description: + 'These cookies are used to enhance the performance and functionality of the website but are non-essential to their use. However, without these cookies, certain functionality (like videos) may become unavailable.', + linkedCategory: 'functionality', + }, + { + title: 'Analytics Cookies', + description: + 'We use analytics cookies to understand how you use our website so we can improve it.', + linkedCategory: 'analytics', + }, + { + title: 'More information', + description: `For any query in relation to the policy on cookies and your choices, please refer to the Privacy Policy.`, + }, + ], + }, }, }, }, - }, + } } diff --git a/src/components/CookieConsent.astro b/src/components/CookieConsent.astro index dcf9b4f..918c7d6 100644 --- a/src/components/CookieConsent.astro +++ b/src/components/CookieConsent.astro @@ -1,11 +1,14 @@ --- import 'vanilla-cookieconsent/dist/cookieconsent.css' ---- - diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 71bfc9b..05cab37 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,6 +1,73 @@ --- import { Image } from 'astro:assets' + import { getRelativeLocaleUrl } from 'astro:i18n' import logo from '../assets/xahau-logo.svg' + + const locale = Astro.currentLocale ?? 'en' + + const translations = { + en: { + tagline: 'This website is open source and open for contributions', + on: 'on', + about: 'About', + features: 'Features', + ecosystem: 'Ecosystem', + roadmap: 'Roadmap', + break: 'Break Xahau', + fraud: 'Report Fraud', + media: 'Media kit', + privacy: 'Privacy Policy', + docs: 'Documentation', + getstarted: 'Get started', + protocol: 'Protocol Reference', + infra: 'Infrastructure', + connect: 'Connect', + events: 'Events', + discord: 'Community Discord', + }, + es: { + tagline: + 'Este sitio web es de código abierto y está abierto a contribuciones', + on: 'en', + about: 'Acerca de', + features: 'Características', + ecosystem: 'Ecosistema', + roadmap: 'Hoja de ruta', + break: 'Break Xahau', + fraud: 'Reportar Fraude', + media: 'Kit de Prensa', + privacy: 'Política de Privacidad', + docs: 'Documentación', + getstarted: 'Primeros pasos', + protocol: 'Referencia de Protocolo', + infra: 'Infraestructura', + connect: 'Conectar', + events: 'Eventos', + discord: 'Discord de la Comunidad', + }, + ja: { + tagline: + 'このウェブサイトはオープンソースで、コントリビューションを受け付けています', + on: 'にて', + about: 'Xahauについて', + features: '機能', + ecosystem: 'エコシステム', + roadmap: 'ロードマップ', + break: 'Break Xahau', + fraud: '不正を報告', + media: 'メディアキット', + privacy: 'プライバシーポリシー', + docs: 'ドキュメント', + getstarted: 'はじめる', + protocol: 'プロトコルリファレンス', + infra: 'インフラストラクチャ', + connect: 'コネクト', + events: 'イベント', + discord: 'コミュニティDiscord', + }, + } + + const t = translations[locale as 'en' | 'es' | 'ja'] || translations.en ---