Localize release note links on non-English releases pages#3819
Open
runlevel5 wants to merge 1 commit intoruby:masterfrom
Open
Localize release note links on non-English releases pages#3819runlevel5 wants to merge 1 commit intoruby:masterfrom
runlevel5 wants to merge 1 commit intoruby:masterfrom
Conversation
The releases pages for non-English languages (ja, ko, uk, vi, zh_cn) always linked to the English (/en/) release posts because the post URL in _data/releases.yml is hardcoded to /en/. Add a localize_post_url Liquid filter plugin that checks whether a translated post exists for the current page language. If a translation is found, the link points to the localized post; otherwise it falls back to the original English URL.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
/en/) release posts because thepostURL in_data/releases.ymlis hardcoded to/en/localize_post_urlLiquid filter plugin that checks whether a translated post exists for the current page's language, linking to it when available and falling back to the English URL otherwiseDetails
The
_data/releases.ymlfile stores a single canonical URL per release (e.g./en/news/2025/12/25/ruby-4-0-0-released/). Previously, all releases pages rendered this URL verbatim, meaning users on non-English pages were always directed to the English release post — even when a translation existed.The new
localize_post_urlfilter (_plugins/localize_post_url.rb) replaces/en/with the current page's language prefix and checks against Jekyll's known posts. If the localized post exists, the link points there; otherwise it falls back to/en/.Example
On the Vietnamese releases page (
/vi/downloads/releases/):/en/news/2025/12/25/ruby-4-0-0-released//vi/news/2025/12/25/ruby-4-0-0-released/(translation exists)/en/news/2026/01/13/ruby-4-0-1-released//en/news/2026/01/13/ruby-4-0-1-released/(no translation, falls back)Files changed
_plugins/localize_post_url.rb— Liquid filter plugin{ja,ko,uk,vi,zh_cn}/downloads/releases/index.md— uselocalize_post_urlfilter