-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
refactor(v2): add more translatable strings #4219
Conversation
@slorber could you confirm the correctness of these changes? After that I will add the Russian translation (and you will provide the translation for the new messages). And also, please write in the to-do list that we need pluralization/number localization support and of course the ability to passing parameters to the translation API (allow using interpolation, I mean). |
[V1] Deploy preview success Built with commit 09794cc |
Size Change: +6 B (0%) Total Size: 158 kB ℹ️ View Unchanged
|
Deploy preview for docusaurus-2 ready! Built with commit 09794cc |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-4219--docusaurus-2.netlify.app/classic/ |
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.
Great thanks, that looks fine to me.
Just think we should find good translation ids, and ".ariaLabel" may not be explicit enough IMHO
I plan to look for a solution for string interpolations soon.
@@ -112,6 +112,7 @@ function DocItem(props: Props): JSX.Element { | |||
<div className="col text--right"> | |||
<em> | |||
<small> | |||
{/* TODO: wait for using interpolation in translation function */} |
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.
Yes, this is a missing piece that I'd like to add, not sure how yet.
React-intl has this feature to handle these kind of cases, and allow to even inject components into a translated string (like a link). But I want to add a very minimal runtime, not something too heavy with many features we don't need. If you know a good lib for that let me know
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.
not 100% related but kind of the same problem if you want to interleave links in a translated string.
On Jest website I used a markdown parser on the client (v1 had a MarkdownBlock component), and it allows to wire the Docusaurus link for the markdown links somehow.
But if we make all this possible through the Translate component, I'd like to avoid the cost of shipping a full md parser to the client.
packages/docusaurus-plugin-pwa/src/theme/PwaReloadPopup/index.js
Outdated
Show resolved
Hide resolved
packages/docusaurus-plugin-pwa/src/theme/PwaReloadPopup/index.js
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/AnnouncementBar/index.tsx
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/CodeBlock/index.tsx
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx
Outdated
Show resolved
Hide resolved
packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.js
Outdated
Show resolved
Hide resolved
b3f0dfc
to
23e3500
Compare
LGTM thanks 👍 Good enough to merge, and we'll keep improving this in the next PRs |
Motivation
Basically adding support for translating arial-label / title attributes.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Preview.
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)