-
Notifications
You must be signed in to change notification settings - Fork 204
Add ru and ja translations for api-requests page #828
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds Russian and Japanese translations for the API requests guide, introduces a translation warning banner, and updates English source files with anchor IDs for consistent linking.
- Added a reusable translation warning banner component and template inclusion.
- Provided banner message translations in English, Russian, Uzbek, Korean, and Japanese.
- Updated the English docs with heading IDs (
{#…}
) to support deep links.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/shared/ui/translation-banner/tmpl.mdx | Added MDX template to render the warning banner inside a caution block |
src/shared/ui/translation-banner/index.tsx | Implemented Banner component to show translation notice and canonical link |
i18n/uz/code.json | Inserted Uzbek translations for the banner texts |
i18n/ru/docusaurus-plugin-content-docs/current/guides/examples/api-requests.mdx | Added full Russian translation of the API requests guide |
i18n/ru/code.json | Inserted Russian translations for the banner texts |
i18n/kr/code.json | Inserted Korean translations for the banner texts |
i18n/ja/docusaurus-plugin-content-docs/current/guides/examples/api-requests.mdx | Added full Japanese translation with banner import |
i18n/ja/code.json | Inserted Japanese translations for the banner texts |
i18n/en/docusaurus-plugin-content-docs/current/guides/examples/api-requests.mdx | Added anchor IDs to headings for deep linking |
i18n/en/code.json | Inserted English banner messages |
Comments suppressed due to low confidence (4)
i18n/ru/docusaurus-plugin-content-docs/current/guides/examples/api-requests.mdx:6
- The translation banner import and its
<TranslationBanner />
invocation are missing in the Russian MDX file. Addimport TranslationBanner from "@site/src/shared/ui/translation-banner/tmpl.mdx"
and insert<TranslationBanner />
before the main heading to display the warning.
import TabItem from '@theme/TabItem';
i18n/ja/code.json:243
- [nitpick] The Japanese message ends with a full-width Japanese period (。) and the banner component appends an English period, resulting in duplicate punctuation. Consider removing the trailing "。" or adjusting punctuation per locale.
"message": "このドキュメントは自動翻訳されており、誤りを含む可能性があります。公式版については、以下を参照してください。"
src/shared/ui/translation-banner/index.tsx:5
- Hard-coding supported language prefixes can lead to missed locales when adding translations. Consider deriving this list programmatically from your Docusaurus i18n configuration or passing it in as a prop.
const languagePrefixes = /\/(ru|uz|kr|ja)\//;
src/shared/ui/translation-banner/index.tsx:9
- Rather than manually manipulating
location.pathname
, you can use Docusaurus utilities likeuseBaseUrl()
or i18n-aware hooks to compute the canonical (English) URL, ensuring consistent routing.
const canonicalPath = location.pathname.replace(languagePrefixes, "/");
Thanks! I'll look into the Russian translation more carefully in a second, but I'd like to suggest not including the Japanese translation unless you can verify it to be correct. When a translation for a page is not present, Docusaurus falls back to the English version, and most browsers include built-in translation tools anyway, so I'd rather give readers the agency to translate the text automatically for themselves if needed |
@illright thanks My main concern is that "localized" site versions are missing any links to the "original" English version, and it can lead to situations, when someone will miss a new documentation page just because it is not translated yet, and docusaurus doesn't show this page in a sidebar. So the idea is to make sure that users don't have to double check the English version every single time. I understand your concern, this is why I added a banner to notify that translation quality is not verified (something similar was done by Google in Google cloud platform docs), but the process of doing this translation is really tedious. As a good middle ground, is it possible to use the English version of a page in the localized site version with a banner? In this case the user can either translate on their own, or read the original article, while being able to see all available pages using any site version. |
I'm not sure I understand what you mean. If I go to the Japanese version of the docs, I see the API requests guide in the sidebar and I can read the English version of it without switching languages |
My bad 😔 I'll remove the banner and Japanese translation, for some reason I thought that they were missing |
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.
Thanks! Here's a more thorough review of the Russian translation with my suggestions
i18n/ru/docusaurus-plugin-content-docs/current/guides/examples/api-requests.mdx
Outdated
Show resolved
Hide resolved
i18n/ru/docusaurus-plugin-content-docs/current/guides/examples/api-requests.mdx
Outdated
Show resolved
Hide resolved
i18n/ru/docusaurus-plugin-content-docs/current/guides/examples/api-requests.mdx
Outdated
Show resolved
Hide resolved
i18n/ru/docusaurus-plugin-content-docs/current/guides/examples/api-requests.mdx
Outdated
Show resolved
Hide resolved
i18n/ru/docusaurus-plugin-content-docs/current/guides/examples/api-requests.mdx
Outdated
Show resolved
Hide resolved
|
||
- Типы данных API | ||
- Ключи кеша | ||
- Общие параметры запросов и мутаций |
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.
suggestion: would be nice to link to the article about using FSD with tanstack query here
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.
done, hope this helps
Co-authored-by: Lev Chelyadinov <illright@proton.me>
Co-authored-by: Lev Chelyadinov <illright@proton.me>
Co-authored-by: Lev Chelyadinov <illright@proton.me>
Co-authored-by: Lev Chelyadinov <illright@proton.me>
Co-authored-by: Lev Chelyadinov <illright@proton.me>
I added some translations for api-requests documentation. I also added a banner warning about automatic translation (I can't verify the quality of Japanese translation)
Please let me know if there are any issues
P.S. I'm planning to add other translations as well, but the process is quite cumbersome "thanks" to mdx format and docusaurus 😭