Skip to content

fix: resolve {build_dir} in translated pages - #2198

Open
yangzhg wants to merge 1 commit into
git:gh-pagesfrom
yangzhg:fix/l10n-build-dir-includes
Open

fix: resolve {build_dir} in translated pages#2198
yangzhg wants to merge 1 commit into
git:gh-pagesfrom
yangzhg:fix/l10n-build-dir-includes

Conversation

@yangzhg

@yangzhg yangzhg commented Aug 27, 2026

Copy link
Copy Markdown

The translated manual page updater leaves {build_dir} in include paths, so the command lists are replaced by missing-file warnings.

Resolve those includes from the language directory. Regular relative includes still use the directory of the source file.

I checked the current git-html-l10n data for es, fr, pt_BR, ru, sv, uk, and zh_HANS-CN, including nested config/merge.adoc files where available. The legacy .txt path still works as well.

Fixes #2197

Resolve translated includes from the language directory when they use
{build_dir}. Keep relative includes based on their source directory.

Fixes git#2197

Signed-off-by: Yang Zhengguo <yangzhgg@gmail.com>
@yangzhg yangzhg changed the title update-docs: resolve {build_dir} in translated pages fix: resolve {build_dir} in translated pages Aug 28, 2026
@yangzhg

yangzhg commented Aug 28, 2026

Copy link
Copy Markdown
Author

@dscho Could you please review this PR? Thanks!

Comment thread script/update-docs.rb
new_content = categories[line]
content.gsub!(/include::({build_dir}\/)?(\S+)\.#{ext}/) do
match = Regexp.last_match
target = "#{match[2]}.#{ext}"

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.

Why not extend the regular expression's second group so that target = match[2] is correct?

Comment thread script/update-docs.rb
content.gsub!(/include::({build_dir}\/)?(\S+)\.#{ext}/) do
match = Regexp.last_match
target = "#{match[2]}.#{ext}"
base = match[1] ? path.split("/", 2).first : File.dirname(path)

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.

How certain can we be that path.split("/", 2) is correct? Are there no subdirectories possible? I am thinking of /path/to/build-dir/Documentation/technical/*, where care needs to be applied to determine the correct replacement for {build_dir}/.

Comment thread script/update-docs.rb
if categories[line]
new_content = categories[line]
content.gsub!(/include::({build_dir}\/)?(\S+)\.#{ext}/) do
match = Regexp.last_match

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.

Couldn't this be done more elegantly via |_, build_dir, path|? (I don't know, I'm no longer fluent in Ruby.)

Comment thread script/update-docs.rb
Comment on lines -233 to +235
get_content_f = proc do |source, target|
name = File.join(File.dirname(source), target)
get_content_f = proc do |base, target|

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.

The rename makes it unnecessarily hard to spot the actual functional change: removing the File.dirname(). And without an adequate explanation in the commit message, the cognitive load required to review this change is sub-optimally big. Please fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Localized git manpages fail to expand {build_dir} includes

2 participants