-
Notifications
You must be signed in to change notification settings - Fork 53
docs: en translation #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
849a262
docs: en translation
undefined-moe 2bd11f0
add redirect for old url
undefined-moe 1a15a00
docs: refine en translation
Charles-IX 62c93f6
docs: align english documentation structure strictly with chinese to …
Charles-IX b24b5a9
Merge pull request #87 from Charles-IX/translate
pandadtdyy 53f3678
rename cn lang to zh
pandadtdyy 7d6ae3d
fix
pandadtdyy 41bf757
fix
pandadtdyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import type { ReactNode } from 'react'; | ||
| import { HomeLayout } from 'fumadocs-ui/layouts/home'; | ||
| import { baseOptions } from '@/lib/layout.shared'; | ||
|
|
||
| export default async function Layout({ | ||
| params, | ||
| children, | ||
| }: { | ||
| params: Promise<{ lang: string }>; | ||
| children: ReactNode; | ||
| }) { | ||
| const { lang } = await params; | ||
| return <HomeLayout {...baseOptions(lang)}>{children}</HomeLayout>; | ||
| } |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { source } from '@/lib/source'; | ||
| import { Popup, PopupContent, PopupTrigger } from 'fumadocs-twoslash/ui'; | ||
| import { Callout } from 'fumadocs-ui/components/callout'; | ||
| import { | ||
| DocsPage, | ||
| DocsBody, | ||
| DocsDescription, | ||
| DocsTitle, | ||
| } from 'fumadocs-ui/page'; | ||
| import { notFound } from 'next/navigation'; | ||
| import defaultMdxComponents from 'fumadocs-ui/mdx'; | ||
|
|
||
| export default async function Page(props: { | ||
| params: Promise<{ lang: string; slug?: string[] }>; | ||
| }) { | ||
| const params = await props.params; | ||
| const page = source.getPage(params.slug, params.lang); | ||
| if (!page) notFound(); | ||
|
|
||
| const MDX = page.data.body; | ||
|
|
||
| return ( | ||
| <DocsPage toc={page.data.toc} full={page.data.full}> | ||
| <DocsTitle>{page.data.title}</DocsTitle> | ||
| <DocsDescription>{page.data.description}</DocsDescription> | ||
| <DocsBody> | ||
| <MDX components={{ | ||
| ...defaultMdxComponents, | ||
| Popup, | ||
| PopupContent, | ||
| PopupTrigger, | ||
| Callout, | ||
| }} /> | ||
| </DocsBody> | ||
| </DocsPage> | ||
| ); | ||
| } | ||
|
|
||
| export async function generateStaticParams() { | ||
| return source.generateParams(); | ||
| } | ||
|
|
||
| export async function generateMetadata(props: { | ||
| params: Promise<{ lang: string; slug?: string[] }>; | ||
| }) { | ||
| const params = await props.params; | ||
| const page = source.getPage(params.slug, params.lang); | ||
| if (!page) notFound(); | ||
|
|
||
| return { | ||
| title: page.data.title, | ||
| description: page.data.description, | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { RootProvider } from 'fumadocs-ui/provider/next'; | ||
| import type { ReactNode } from 'react'; | ||
| import { i18nUI } from '@/lib/layout.shared'; | ||
| import { i18n } from '@/lib/i18n'; | ||
|
|
||
| export default async function LangLayout({ | ||
| params, | ||
| children, | ||
| }: { | ||
| params: Promise<{ lang: string }>; | ||
| children: ReactNode; | ||
| }) { | ||
| const { lang } = await params; | ||
|
|
||
| return ( | ||
| <RootProvider | ||
| i18n={i18nUI.provider(lang)} | ||
| search={{ | ||
| options: { | ||
| type: 'static', | ||
| }, | ||
| }} | ||
| > | ||
| {children} | ||
| </RootProvider> | ||
| ); | ||
| } | ||
|
|
||
| export function generateStaticParams() { | ||
| return i18n.languages.map((lang) => ({ lang })); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,16 @@ | ||
| import { redirect } from 'next/navigation'; | ||
| import { source } from '@/lib/source'; | ||
| import { Popup, PopupContent, PopupTrigger } from 'fumadocs-twoslash/ui'; | ||
| import { Callout } from 'fumadocs-ui/components/callout'; | ||
| import { | ||
| DocsPage, | ||
| DocsBody, | ||
| DocsDescription, | ||
| DocsTitle, | ||
| } from 'fumadocs-ui/page'; | ||
| import { notFound } from 'next/navigation'; | ||
| import defaultMdxComponents from 'fumadocs-ui/mdx'; | ||
|
|
||
| export default async function Page(props: { | ||
| export default async function DocsRedirectPage(props: { | ||
| params: Promise<{ slug?: string[] }>; | ||
| }) { | ||
| const params = await props.params; | ||
| const page = source.getPage(params.slug); | ||
| if (!page) notFound(); | ||
|
|
||
| const MDX = page.data.body; | ||
|
|
||
| return ( | ||
| <DocsPage toc={page.data.toc} full={page.data.full}> | ||
| <DocsTitle>{page.data.title}</DocsTitle> | ||
| <DocsDescription>{page.data.description}</DocsDescription> | ||
| <DocsBody> | ||
| <MDX components={{ | ||
| ...defaultMdxComponents, | ||
| Popup, | ||
| PopupContent, | ||
| PopupTrigger, | ||
| Callout, | ||
| }} /> | ||
| </DocsBody> | ||
| </DocsPage> | ||
| ); | ||
| const { slug } = await props.params; | ||
| const path = slug?.length ? `/zh/docs/${slug.join('/')}` : '/zh/docs'; | ||
| redirect(path); | ||
| } | ||
|
|
||
| export async function generateStaticParams() { | ||
| return source.generateParams(); | ||
| } | ||
|
|
||
| export async function generateMetadata(props: { | ||
| params: Promise<{ slug?: string[] }>; | ||
| }) { | ||
| const params = await props.params; | ||
| const page = source.getPage(params.slug); | ||
| if (!page) notFound(); | ||
|
|
||
| return { | ||
| title: page.data.title, | ||
| description: page.data.description, | ||
| }; | ||
| return source.generateParams() | ||
| .filter((p) => p.lang === 'zh') | ||
| .map(({ slug }) => ({ slug })); | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { redirect } from 'next/navigation'; | ||
|
|
||
| export default function RootPage() { | ||
| redirect('/zh'); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| --- | ||
| title: Debugging Guide | ||
| --- | ||
|
|
||
| ## Process Management | ||
|
|
||
| Access your server console and use `pm2 ls` to view the status of running processes. | ||
| A healthy Hydro instance typically has four processes: `hydrooj`, `hydro-sandbox`, `mongodb`, and `caddy`. | ||
|
|
||
| If any processes are missing or failing to start: | ||
| 1. Run `pm2 stop all` and `pm2 del all`. | ||
| 2. Rerun the installation script to restore the default process configuration. | ||
|
|
||
| ### Troubleshooting Process Failures | ||
|
|
||
| - **Caddy**: Usually fails due to port conflicts (port 80/443 already in use) or syntax errors in `~/.hydro/Caddyfile`. Run `cd ~/.hydro && caddy run` in the foreground to see detailed error messages. | ||
| - **Hydro-Sandbox**: Often fails due to insufficient permissions or an outdated kernel. Check logs with `pm2 logs hydro-sandbox --lines 100`. | ||
| - **HydroOJ**: If the main service fails, refer to the section below. | ||
|
|
||
| ## Debugging HydroOJ | ||
|
|
||
| To inspect detailed logs, stop the background process and run Hydro in the foreground: | ||
| 1. `pm2 stop hydrooj` | ||
| 2. Run the command `hydrooj` directly. | ||
|
|
||
| **Suggested Steps:** | ||
| 1. **Update**: Ensure you are running the latest version. | ||
| 2. **Plugins**: Third-party plugins are a common cause of crashes. | ||
| - Back up your plugin list: `cp ~/.hydro/addon.json ~/.hydro/addon.json.bak`. | ||
| - View active plugins: `hydrooj addon list`. | ||
| - Remove non-official plugins (those without the `@hydrooj/` prefix): `hydrooj addon remove <name>`. | ||
| 3. **Restart**: Check if the system runs correctly without third-party plugins. If it does, re-enable them one by one to identify the culprit. | ||
| 4. **Support**: If the issue persists, provide the development team with the full console output from startup until the error occurs. | ||
|
|
||
| ## Frontend Issues | ||
|
|
||
| Symptoms include pages failing to load, infinite loading spinners, or error prompts (yellow/red) at the bottom-left of the screen. | ||
|
|
||
| 1. **Clear Cache**: Press `Ctrl+Shift+Delete` to clear your browser cache and reload. | ||
| 2. **Browser Version**: Ensure you are using the latest version of Chrome or a Chromium-based browser. | ||
| 3. **Disable Extensions**: Browser extensions can sometimes interfere with page scripts. | ||
| 4. **Developer Tools**: Press `F12`, go to the **Console** tab for script errors, and the **Network** tab to identify failed requests. | ||
| 5. **Report**: When seeking help in the user group, please include screenshots of both the Console and Network tabs. | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The root tag is hardcoded to lang="zh", so English routes (e.g. /en/...) will still announce the document as Chinese, which hurts accessibility/SEO and can affect screen reader pronunciation. Please make the lang attribute reflect the active locale (or restructure layouts so the lang segment can control it).