Skip to content
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

fix(theme-classic): should use plurals for category items description #9851

Merged
merged 3 commits into from
Feb 15, 2024

Conversation

baradusov
Copy link
Contributor

@baradusov baradusov commented Feb 15, 2024

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

When enabling russian language doc cards showing source string for default description. I made a fix to use appropriate plural form of the description.

Test Plan

Before:
Screenshot 2024-02-15 at 15 18 11

After:
Screenshot 2024-02-15 at 15 21 44

Test links

Deploy preview: https://deploy-preview-9851--docusaurus-2.netlify.app/

Related issues/PRs

@facebook-github-bot
Copy link
Contributor

Hi @baradusov!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copy link

netlify bot commented Feb 15, 2024

[V2]

Name Link
🔨 Latest commit 6da7e10
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/65ce5ddc3bb4c70008701249
😎 Deploy Preview https://deploy-preview-9851--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Feb 15, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 66 🟢 98 🟢 96 🟢 100 🟠 88 Report
/docs/installation 🟠 86 🟢 96 🟢 100 🟢 100 🟠 88 Report
/docs/category/getting-started 🟠 76 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog 🟠 69 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 63 🟢 96 🟢 100 🟢 100 🟠 88 Report
/blog/tags/release 🟠 70 🟢 100 🟢 100 🟠 80 🟠 88 Report
/blog/tags 🟠 76 🟢 100 🟢 100 🟢 90 🟠 88 Report

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 15, 2024
Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Yes it should support plural forms.

Unfortunately other languages will have to be fixed too because the string does not contain all plural forms, but that's not your responsibility to fix, and other languages should keep working as is (ie render as before a possibly wrong label)


BTW if you speak Russian, it would be a good opportunity to check the existing translations, notably this one missing plural forms:

  "theme.blog.post.readingTime.plurals": "{readingTime} мин. чтения",

translate(
{
message: '{count} items',
id: 'theme.docs.DocCard.categoryDescription',
Copy link
Collaborator

@slorber slorber Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a .plurals suffix to this id?

We usually have this convention to quickly identify strings that support plural rules.

Also need to rename all existing keys in docusaurus-theme-translations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the review
i pushed the changes you requested

@baradusov
Copy link
Contributor Author

BTW if you speak Russian, it would be a good opportunity to check the existing translations, notably this one missing plural forms:

  "theme.blog.post.readingTime.plurals": "{readingTime} мин. чтения",

@slorber I checked all russian translations and everything seems okay to me

"theme.blog.post.readingTime.plurals": "{readingTime} мин. чтения"
this particular translation doesn't need plural forms, because the word that should be pluralized мин.(minutes) is shorthand in this case

@baradusov baradusov requested a review from slorber February 15, 2024 16:16
@slorber
Copy link
Collaborator

slorber commented Feb 15, 2024

Thanks 👍

"theme.blog.post.readingTime.plurals": "{readingTime} мин. чтения"
this particular translation doesn't need plural forms, because the word that should be pluralized мин.(minutes) is shorthand in this case

Actually it's better to use 3 times the plural forms even though they are the same string. If you don't there will be a warning saying plural forms are missing, helping us actually catch that we may have forgotten them.

@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Feb 15, 2024
@slorber slorber merged commit 3426f84 into facebook:main Feb 15, 2024
31 checks passed
@slorber slorber added the to backport This PR is planned to be backported to a stable version of Docusaurus label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release. to backport This PR is planned to be backported to a stable version of Docusaurus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants