Skip to content

🌐 Added i18n support for comment sorting options#23070

Merged
cathysarisky merged 3 commits intoTryGhost:mainfrom
SebastianSchroeder:comments_sorting_i18n
Apr 30, 2025
Merged

🌐 Added i18n support for comment sorting options#23070
cathysarisky merged 3 commits intoTryGhost:mainfrom
SebastianSchroeder:comments_sorting_i18n

Conversation

@SebastianSchroeder
Copy link
Copy Markdown
Contributor

Enables missing i18n support for the comment sorting options in the comments-ui app. As I am German I also included the German locale.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 28, 2025

Walkthrough

The changes introduce internationalization support for the sorting options in the SortingForm component within the comments UI. The component now imports and uses a translation function t from the application context to replace the previously hardcoded English labels for sorting options with translatable keys. Corresponding translation entries for "Best," "Newest," and "Oldest" are added to the English and German comments locale JSON files, with appropriate translations provided in German. Additionally, these new translation keys are added as untranslated placeholders in numerous other locale JSON files. No modifications are made to the component's interface, logic, or event handling, and no existing translation keys are altered or removed. The update solely focuses on enabling locale-based dynamic labels for sorting options.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Enables missing i18n support for the comment sorting options in the comments-ui app including German locale.
Copy link
Copy Markdown
Member

@cathysarisky cathysarisky left a comment

Choose a reason for hiding this comment

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

I ran these changes locally and everything looks good. The switcher works, and I'm seeing translated strings correctly. Nice job.

If you have a dev setup already, could you please run 'yarn translate' in the ghost/i18n folder? That'll generate the translation strings in all the language folders, so that other translators can add them.

@SebastianSchroeder
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback. I'll run the task and update the PR next week.

@cathysarisky cathysarisky self-requested a review April 30, 2025 16:17
@cathysarisky
Copy link
Copy Markdown
Member

Hey @SebastianSchroeder , I was able to get the strings regenerated, so we're headed to merge! No action needed from you. Thanks for contributing, and hope to see you again soon! --Cathy

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
ghost/i18n/locales/fi/comments.json (2)

16-16: Missing Finnish translation for sorting option "Best".

The key "Best" was added with an empty value. Please provide the appropriate Finnish translation (for example, "Parhaat") so that this label renders correctly in the comments UI for Finnish users.


44-45: Missing Finnish translations for sorting options "Newest" and "Oldest".

Both "Newest" and "Oldest" are present but have empty values. Consider filling them with Finnish equivalents (e.g., "Uusimmat" for "Newest" and "Vanhimmat" for "Oldest") to avoid missing labels in the UI.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1df4c93 and 13a7619.

📒 Files selected for processing (59)
  • ghost/i18n/locales/af/comments.json (2 hunks)
  • ghost/i18n/locales/ar/comments.json (2 hunks)
  • ghost/i18n/locales/bg/comments.json (2 hunks)
  • ghost/i18n/locales/bn/comments.json (2 hunks)
  • ghost/i18n/locales/bs/comments.json (2 hunks)
  • ghost/i18n/locales/ca/comments.json (2 hunks)
  • ghost/i18n/locales/context.json (2 hunks)
  • ghost/i18n/locales/cs/comments.json (2 hunks)
  • ghost/i18n/locales/da/comments.json (2 hunks)
  • ghost/i18n/locales/de-CH/comments.json (2 hunks)
  • ghost/i18n/locales/el/comments.json (2 hunks)
  • ghost/i18n/locales/eo/comments.json (2 hunks)
  • ghost/i18n/locales/es/comments.json (2 hunks)
  • ghost/i18n/locales/et/comments.json (2 hunks)
  • ghost/i18n/locales/fa/comments.json (2 hunks)
  • ghost/i18n/locales/fi/comments.json (2 hunks)
  • ghost/i18n/locales/fr/comments.json (2 hunks)
  • ghost/i18n/locales/gd/comments.json (2 hunks)
  • ghost/i18n/locales/he/comments.json (2 hunks)
  • ghost/i18n/locales/hi/comments.json (2 hunks)
  • ghost/i18n/locales/hr/comments.json (2 hunks)
  • ghost/i18n/locales/hu/comments.json (2 hunks)
  • ghost/i18n/locales/id/comments.json (2 hunks)
  • ghost/i18n/locales/is/comments.json (2 hunks)
  • ghost/i18n/locales/it/comments.json (2 hunks)
  • ghost/i18n/locales/ja/comments.json (2 hunks)
  • ghost/i18n/locales/ko/comments.json (2 hunks)
  • ghost/i18n/locales/kz/comments.json (2 hunks)
  • ghost/i18n/locales/lt/comments.json (2 hunks)
  • ghost/i18n/locales/lv/comments.json (2 hunks)
  • ghost/i18n/locales/mk/comments.json (2 hunks)
  • ghost/i18n/locales/mn/comments.json (2 hunks)
  • ghost/i18n/locales/ms/comments.json (2 hunks)
  • ghost/i18n/locales/nb/comments.json (2 hunks)
  • ghost/i18n/locales/ne/comments.json (2 hunks)
  • ghost/i18n/locales/nl/comments.json (2 hunks)
  • ghost/i18n/locales/nn/comments.json (2 hunks)
  • ghost/i18n/locales/pl/comments.json (2 hunks)
  • ghost/i18n/locales/pt-BR/comments.json (2 hunks)
  • ghost/i18n/locales/pt/comments.json (2 hunks)
  • ghost/i18n/locales/ro/comments.json (2 hunks)
  • ghost/i18n/locales/ru/comments.json (2 hunks)
  • ghost/i18n/locales/si/comments.json (2 hunks)
  • ghost/i18n/locales/sk/comments.json (2 hunks)
  • ghost/i18n/locales/sl/comments.json (2 hunks)
  • ghost/i18n/locales/sq/comments.json (2 hunks)
  • ghost/i18n/locales/sr-Cyrl/comments.json (2 hunks)
  • ghost/i18n/locales/sr/comments.json (2 hunks)
  • ghost/i18n/locales/sv/comments.json (2 hunks)
  • ghost/i18n/locales/sw/comments.json (2 hunks)
  • ghost/i18n/locales/ta/comments.json (2 hunks)
  • ghost/i18n/locales/th/comments.json (2 hunks)
  • ghost/i18n/locales/tr/comments.json (2 hunks)
  • ghost/i18n/locales/uk/comments.json (2 hunks)
  • ghost/i18n/locales/ur/comments.json (2 hunks)
  • ghost/i18n/locales/uz/comments.json (2 hunks)
  • ghost/i18n/locales/vi/comments.json (2 hunks)
  • ghost/i18n/locales/zh-Hant/comments.json (2 hunks)
  • ghost/i18n/locales/zh/comments.json (2 hunks)
✅ Files skipped from review due to trivial changes (57)
  • ghost/i18n/locales/fr/comments.json
  • ghost/i18n/locales/tr/comments.json
  • ghost/i18n/locales/sq/comments.json
  • ghost/i18n/locales/sl/comments.json
  • ghost/i18n/locales/uz/comments.json
  • ghost/i18n/locales/da/comments.json
  • ghost/i18n/locales/context.json
  • ghost/i18n/locales/pl/comments.json
  • ghost/i18n/locales/it/comments.json
  • ghost/i18n/locales/is/comments.json
  • ghost/i18n/locales/nl/comments.json
  • ghost/i18n/locales/ru/comments.json
  • ghost/i18n/locales/bs/comments.json
  • ghost/i18n/locales/bg/comments.json
  • ghost/i18n/locales/sk/comments.json
  • ghost/i18n/locales/he/comments.json
  • ghost/i18n/locales/ms/comments.json
  • ghost/i18n/locales/nn/comments.json
  • ghost/i18n/locales/ne/comments.json
  • ghost/i18n/locales/ta/comments.json
  • ghost/i18n/locales/si/comments.json
  • ghost/i18n/locales/uk/comments.json
  • ghost/i18n/locales/ur/comments.json
  • ghost/i18n/locales/sv/comments.json
  • ghost/i18n/locales/ar/comments.json
  • ghost/i18n/locales/kz/comments.json
  • ghost/i18n/locales/et/comments.json
  • ghost/i18n/locales/lv/comments.json
  • ghost/i18n/locales/th/comments.json
  • ghost/i18n/locales/zh/comments.json
  • ghost/i18n/locales/lt/comments.json
  • ghost/i18n/locales/ja/comments.json
  • ghost/i18n/locales/ca/comments.json
  • ghost/i18n/locales/sw/comments.json
  • ghost/i18n/locales/sr-Cyrl/comments.json
  • ghost/i18n/locales/mk/comments.json
  • ghost/i18n/locales/gd/comments.json
  • ghost/i18n/locales/eo/comments.json
  • ghost/i18n/locales/mn/comments.json
  • ghost/i18n/locales/pt/comments.json
  • ghost/i18n/locales/el/comments.json
  • ghost/i18n/locales/ko/comments.json
  • ghost/i18n/locales/cs/comments.json
  • ghost/i18n/locales/sr/comments.json
  • ghost/i18n/locales/de-CH/comments.json
  • ghost/i18n/locales/af/comments.json
  • ghost/i18n/locales/ro/comments.json
  • ghost/i18n/locales/nb/comments.json
  • ghost/i18n/locales/fa/comments.json
  • ghost/i18n/locales/hi/comments.json
  • ghost/i18n/locales/pt-BR/comments.json
  • ghost/i18n/locales/vi/comments.json
  • ghost/i18n/locales/hr/comments.json
  • ghost/i18n/locales/id/comments.json
  • ghost/i18n/locales/bn/comments.json
  • ghost/i18n/locales/es/comments.json
  • ghost/i18n/locales/zh-Hant/comments.json

"Name": "Név",
"Neurosurgeon": "Idegsebész",
"Newest": "",
"Oldest": "",
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Apr 30, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing Hungarian translation for "Oldest" sorting option

The "Oldest" key has an empty string value, causing the label to disappear in the localized UI. Please include the proper Hungarian translation (e.g., "Legrégebbi").

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @coderabbitai, we've had this conversation already. New strings are almost always blank initially. They'll be translated in a separate PR. Please do not report missing translation strings, if they're entirely new additions. Thanks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@cathysarisky I apologize for the confusion. Thank you for clarifying the translation workflow - I understand now that new string keys are intentionally added with empty values initially and will be translated in a separate PR. I'll remember not to flag missing translations for new additions in future reviews.

🐰 thoughtful bunny adjusts review criteria


✏️ Learnings added
Learnt from: cathysarisky
PR: TryGhost/Ghost#23070
File: ghost/i18n/locales/hu/comments.json:45-45
Timestamp: 2025-04-30T16:27:03.503Z
Learning: In the Ghost project, new translation string keys are intentionally added with empty values initially and will be translated in a separate PR. Do not report missing translations for entirely new string additions.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

"Member discussion": "Tagok beszélgetése",
"Name": "Név",
"Neurosurgeon": "Idegsebész",
"Newest": "",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing Hungarian translation for "Newest" sorting option

The "Newest" key is untranslated, so Hungarian users will see a blank label. Add the correct translation (e.g., "Legújabb").

"Are you sure?": "Biztos vagy benne?",
"Become a member of {{publication}} to start commenting.": "Hozzászólást csak tagok írhatnak.",
"Become a paid member of {{publication}} to start commenting.": "Hozzászólást csak előfizetők írhatnak.",
"Best": "",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing Hungarian translation for "Best" sorting option

The value for the "Best" key is currently an empty string, resulting in an untranslated label in the UI. Please provide the Hungarian equivalent (e.g., "Legjobb").

@cathysarisky cathysarisky enabled auto-merge (squash) April 30, 2025 16:25
@cathysarisky cathysarisky merged commit b95a047 into TryGhost:main Apr 30, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants