diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/Capital.iml b/.idea/Capital.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/Capital.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..b81b702 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml new file mode 100644 index 0000000..7e80b84 --- /dev/null +++ b/.idea/material_theme_project_new.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..97aa9ab --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e0b2db6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.words": [ + "Testflight" + ] +} \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index fa64b19..6b1f8bf 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/next-i18next.config.js b/next-i18next.config.js new file mode 100644 index 0000000..2d3b95d --- /dev/null +++ b/next-i18next.config.js @@ -0,0 +1,7 @@ +/** @type {import('next-i18next').UserConfig} */ +module.exports = { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'zh-CN'], + }, +} diff --git a/next.config.ts b/next.config.ts index 6b7b71f..ea68ef3 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,10 @@ import type { NextConfig } from 'next' +import { i18n } from './next-i18next.config' + const nextConfig: NextConfig = { /* config options here */ + i18n, reactStrictMode: true, output: 'standalone', generateBuildId: async () => { diff --git a/package.json b/package.json index 79f279f..823cf5b 100644 --- a/package.json +++ b/package.json @@ -27,11 +27,14 @@ "axios-case-converter": "^1.1.1", "cookies-next": "^5.0.2", "feed": "^4.2.2", + "i18next": "^24.2.2", "next": "^15.1.5", + "next-i18next": "^15.4.2", "next-nprogress-bar": "^2.4.3", "react": "^19.0.0", "react-dom": "^19.0.0", "react-hook-form": "^7.54.2", + "react-i18next": "^15.4.0", "rehype-sanitize": "^6.0.0", "rehype-stringify": "^10.0.1", "remark-breaks": "^4.0.0", @@ -57,6 +60,7 @@ }, "trustedDependencies": [ "@vercel/speed-insights", + "core-js", "esbuild", "sharp" ] diff --git a/public/locales/en-US/common.json b/public/locales/en-US/common.json new file mode 100644 index 0000000..bb94c1e --- /dev/null +++ b/public/locales/en-US/common.json @@ -0,0 +1,13 @@ +{ + "actionDownload": "Download", + "downloadPlatform": "Platform", + "downloadDistribution": "Distribution", + "downloadAppleStore": "iOS / macOS (App Store)", + "downloadAppleTestflight": "iOS / macOS (TestFlight)", + "downloadAndroid": "Android", + "downloadWindows": "Windows", + "downloadWeb": "Web", + "downloadSourceCode": "Source Code", + "actionOpen": "Open", + "faq": "Frequently Asked Questions" +} diff --git a/public/locales/en-US/product-solar-network.json b/public/locales/en-US/product-solar-network.json new file mode 100644 index 0000000..a1fe256 --- /dev/null +++ b/public/locales/en-US/product-solar-network.json @@ -0,0 +1,13 @@ +{ + "appName": "Solar Network", + "appDescription": "The next generation Social Network platform.", + "appSlogan": "Social Network, Redefined.", + "faq1": "What's the relationship between Solar Network and Solian?", + "faq1a": "Solian is the official app made for Solar Network. And the Solar Network is the official HyperNet instance hosted by Solsynth LLC. For simple, Solian is the app, and the Solar Network is the platform.", + "faq2": "What's the relationship between Solar Network and HyperNet?", + "faq2a": "HyperNet is the entire project including frontend app (also knowns as Solian for public) and the backend server. And the Solar Network is the official HyperNet instance which hosted and managed by Solsynth LLC who developed the HyperNet Project.", + "faq3": "Which rules do I need to follow while using Solar Network?", + "faq3a": "Check out our Terms & Conditions for a detailed explanation of what you can do and cannot do on Solar Network. If you violate any of these rules, we have the right to suspend or terminate your account., you can see them in the drawer.", + "faq4": "If I have any question about Solar Network, where can I get help?", + "faq4a": "Feel free to email as at lily@solsynth.dev" +} diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json new file mode 100644 index 0000000..3c16c4e --- /dev/null +++ b/public/locales/zh-CN/common.json @@ -0,0 +1,13 @@ +{ + "actionDownload": "下载", + "downloadPlatform": "平台", + "downloadDistribution": "分发", + "downloadAppleStore": "iOS / macOS (App Store)", + "downloadAppleTestflight": "iOS / macOS (TestFlight)", + "downloadAndroid": "安卓", + "downloadWindows": "Windows", + "downloadWeb": "网页版", + "downloadSourceCode": "源代码", + "actionOpen": "打开", + "faq": "常见问题" +} diff --git a/public/locales/zh-CN/product-solar-network.json b/public/locales/zh-CN/product-solar-network.json new file mode 100644 index 0000000..98d6cf3 --- /dev/null +++ b/public/locales/zh-CN/product-solar-network.json @@ -0,0 +1,13 @@ +{ + "appName": "Solar Network", + "appDescription": "下一代社交网络平台", + "appSlogan": "重新定义社交网络", + "faq1": "Solar Network 和 Solian 之间有什么关系?", + "faq1a": "Solian 是为 Solar Network 制作的官方应用程序。而 Solar Network 是由 Solsynth LLC 托管的官方 HyperNet 实例。简单来说,Solian 是应用程序,而 Solar Network 是平台。", + "faq2": "Solar Network 和 HyperNet 之间有什么关系?", + "faq2a": "HyperNet 是整个项目,包括前端应用程序(公众也称 Solian)和后端服务器。而 Solar Network 是由开发 HyperNet 项目的 Solsynth LLC 托管和管理的官方 HyperNet 实例。", + "faq3": "使用 Solar Network 时我需要遵守哪些规则?", + "faq3a": "查看我们的条款和条件,详细了解您在 Solar Network 上可以做什么和不能做什么。如果您违反任何这些规则,我们有权暂停或终止您的帐户。您可以在抽屉中看到它们。", + "faq4": "如果我对 Solar Network 有任何疑问,我可以在哪里获得帮助?", + "faq4a": "你可以发邮件给我们的客户服务获取支持:lily@solsynth.dev" +} diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 9ab22b2..e598229 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,4 +1,5 @@ import '@/styles/globals.css' + import type { AppProps } from 'next/app' import { Box, createTheme, CssBaseline, ThemeProvider } from '@mui/material' import { Roboto } from 'next/font/google' @@ -7,6 +8,7 @@ import { PagesProgressBar as ProgressBar } from 'next-nprogress-bar' import { AppProvider } from '@toolpad/core/nextjs' import { useUserStore } from 'solar-js-sdk' import { useEffect } from 'react' +import { appWithTranslation } from 'next-i18next' import Head from 'next/head' const fontRoboto = Roboto({ @@ -31,7 +33,7 @@ const siteTheme = createTheme({ }, }) -export default function App({ Component, pageProps }: AppProps) { +function App({ Component, pageProps }: AppProps) { const userStore = useUserStore() useEffect(() => { @@ -80,3 +82,5 @@ export default function App({ Component, pageProps }: AppProps) { ) } + +export default appWithTranslation(App) \ No newline at end of file diff --git a/src/pages/products/solar-network.tsx b/src/pages/products/solar-network.tsx index a7c788c..f358c31 100644 --- a/src/pages/products/solar-network.tsx +++ b/src/pages/products/solar-network.tsx @@ -15,6 +15,7 @@ import { } from '@mui/material' import { JSX } from 'react' import { Roboto_Serif } from 'next/font/google' +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import Image from 'next/image' import NextLink from 'next/link' @@ -31,6 +32,7 @@ import ImgSolarNetworkIcon from '@/assets/products/solar-network/icon.png' import ImgSolarNetworkAlpha from '@/assets/products/solar-network/alpha.webp' import 'animate.css' +import { useTranslation } from 'next-i18next' interface DownloadableAsset { icon: JSX.Element @@ -51,68 +53,69 @@ const fontSerif = Roboto_Serif({ style: 'italic', }) -export async function getStaticProps() { +export async function getStaticProps({ locale }: { locale: string }) { return { props: { title: 'Solar Network', + ...(await serverSideTranslations(locale, ['common', 'product-solar-network'])), }, } } export default function ProductSolarNetwork() { + const { t: ct } = useTranslation('common') + const { t } = useTranslation('product-solar-network') + const downloadableAssets: DownloadableAsset[] = [ { icon: , - title: 'iOS / macOS (App Store)', + title: ct('downloadAppleStore'), href: 'https://apps.apple.com/us/app/solian/id6499032345?itscg=30200&itsct=apps_box_link&mttnsubad=6499032345', }, { icon: , - title: 'iOS / macOS (TestFlight)', + title: ct('downloadAppleTestflight'), href: 'https://testflight.apple.com/join/YJ0lmN6O', }, { icon: , - title: 'Android', + title: ct('downloadAndroid'), href: 'https://files.solsynth.dev/production01/solian/app-arm64-v8a-release.apk', }, { icon: , - title: 'Windows', + title: ct('downloadWindows'), href: 'https://files.solsynth.dev/production01/solian/windows-x86_64-release.zip', }, { icon: , - title: 'Web', + title: ct('downloadWeb'), href: 'https://sn.solsynth.dev', open: true, }, { icon: , - title: 'Source Code', + title: ct('downloadSourceCode'), href: 'https://github.com/Solsynth/HyperNet.Surface', }, ] const askableQuestions: AskableQuestion[] = [ { - question: "What's the relationship between Solar Network and Solian?", - answer: - 'Solian is the official app made for Solar Network. And the Solar Network is the official HyperNet instance hosted by Solsynth LLC. For simple, Solian is the app, and the Solar Network is the platform.', + question: t('faq1'), + answer: t('faq1a'), }, { - question: "What's the relationship between Solar Network and HyperNet?", - answer: - 'HyperNet is the entire project including frontend app (also knowns as Solian for public) and the backend server. And the Solar Network is the official HyperNet instance which hosted and managed by Solsynth LLC who developed the HyperNet Project.', + question: t('faq2'), + answer: t('faq2a'), }, { - question: 'Which rules do I need to follow while using Solar Network?', - answer: - 'Check out our Terms & Conditions for a detailed explanation of what you can do and cannot do on Solar Network. If you violate any of these rules, we have the right to suspend or terminate your account., you can see them in the drawer.', + question: t('faq3'), + answer: t('faq3a'), }, { - question: 'If I have any question about Solar Network, where can I get help?', - answer: 'Feel free to email as at lily@solsynth.dev', + question: t('faq4'), + answer: t('faq4a'), }, ] @@ -129,7 +132,7 @@ export default function ProductSolarNetwork() { /> - Solar Network + {t('appName')} - The next generation Social Network platform. + {t('appDescription')} - Social Network, Redefined. + {t('appSlogan')} - Download + {ct('actionDownload')} @@ -170,15 +173,15 @@ export default function ProductSolarNetwork() { - Download + {ct('actionDownload')} - Platform - Distribution + {ct('downloadPlatform')} + {ct('downloadDistribution')} @@ -190,12 +193,12 @@ export default function ProductSolarNetwork() { {a.open ? ( - Open now + {ct('actionOpen')} ) : ( - Download now + {ct('actionDownload')} )} @@ -209,7 +212,7 @@ export default function ProductSolarNetwork() { - Frequently Asked Questions + {ct('faq')} diff --git a/tsconfig.json b/tsconfig.json index 572b7ad..4c6736c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,6 @@ "@/*": ["./src/*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "next-i18next.config.js"], "exclude": ["node_modules"] }