Skip to content

Add multi-language build (i18n) + French translation - #465

Open
FreeProject089 wants to merge 2 commits into
Heatblur-Simulations:masterfrom
FreeProject089:master
Open

FreeProject089 wants to merge 2 commits into
Heatblur-Simulations:masterfrom
FreeProject089:master

Conversation

@FreeProject089

Copy link
Copy Markdown

Summary

  • Adds a proper i18n setup: English source moved to src/en/, a single command
    (npm run build / node i18n/build.js) now builds every configured language
    in one pass — one HTML site per language (book/html/<lang>) and one PDF per
    language (book/pdf/<lang>.pdf), plus a small landing page that remembers
    the visitor's last language choice.
  • Adds an in-page language switcher in the menu bar, styled like the existing
    theme picker, that jumps to the same page in the other language.
  • npm run serve builds and serves the multi-language output locally so the
    switcher/landing page can be tested exactly as deployed — plain mdbook serve
    only serves one language at the site root and 404s on switcher links.
  • Adds the French translation (src/fr/), reviewed file-by-file against the
    English source: literal cockpit switch/panel labels, weapon designations,
    and BIT-checklist action values are kept in English (matching what's
    actually displayed in-sim), machine-translation artifacts and garbled
    sentences fixed.
  • CI (deploy-gh-pages.yaml, deploy-release-pdf.yaml) updated to run the new
    build script and publish a PDF per language.

See i18n/README.md for how it works and how to add another language.

Test plan

  • node i18n/build.js completes with 0 HTML parse warnings and 0 errors
    for every language
  • All 2 PDFs generate successfully
  • Every image reference resolves and en/fr reference the identical
    underlying images, in the same order, on every page
  • Language switcher verified in-browser: lands on the same page in the
    other language, no 404s
  • No leftover encoding corruption in the French source

@FreeProject089
FreeProject089 requested a review from a team as a code owner July 22, 2026 02:00

@Zabuzard Zabuzard left a comment •

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.

Oh wow, very interesting!
First of all, thank you for your efforts and the interest 👍

The big thing first: This appears to be AI translated - that is not bad per se, but I do need to run this through the team first. I am not sure if we are currently able to officially support a language without a person dedicated to keeping it up2date. Having such a person is the only reason we can currently offer the Chinese manual.

Apart from that, a few things I noticed that would likely need to be addressed before this can be merged:

  • that commit that uses GITHUB_TOKEN and removes cname needs to be reverted (also says so in its description "revert this before merging")
  • I do not thinnk that we can currently support the assumption in this switcher-system that the language variations are all always on the same version. That is, it needs to gracefully be able to handle that some file foo.md on EN doesnt exist on FR or vice versa. The same goes for the images. For the images specifically it is also not safe to assume (at least in the current version) that they are language agnostic. Some of them have for example english annotations that need to be translated as well (see the chinese manual which did that).
  • Im not the biggest fan of putting in npm for this. But okay, maybe the easiest choice... Tech-wise if we could substitute that with a Python script it would be better for the team and the existing tech-stack.

Sorry that you are running into these questions now. Its not your fault and more that this project right now isnt well prepared for offerring multiple languages yet. I appreciate you trying to spearhead this though 👍

Some alternatives:

  • everything moves to a branch l10n/fr, next to the existing l10n/cn - but then I also need to see if we want to support AI translations officially
  • you can ofc always keep it on your fork and also distribute it inofficially as "ive translated heatblurs manual to french, look here: ...". we would ofc also support that and could also put the PDF into the modules doc folder as long as its clear that its not an "official module by Heatblur", so to speak

Either case, Ill get back to you with the feedback regarding AI translations, thanks! 😃

@FreeProject089

Copy link
Copy Markdown
Author

Thank you very much for your detailed feedback and for taking the time to review the PR.

I have taken note of the different points you mentioned. I will apply the necessary changes on my side when I have the time:

  • revert the commit related to GITHUB_TOKEN and the CNAME;
  • improve the language switcher system with a better fallback when files or resources are missing;
  • take into account the translation of images containing text;
  • consider replacing npm with a Python script to better fit the team's needs and the existing stack.

Regarding npm, I chose it mainly because I am more comfortable with JavaScript, but I understand that Python may be more suitable for the team and for maintaining the project.

Regarding the AI translation, I completely understand the concerns. My goal is not to provide an unchecked machine translation: I review and correct the translation manually to ensure a better quality result.

Thank you again for the feedback. I will continue improving the PR based on your suggestions.

Move English source to src/<lang>/ layout and add a single-command
build (npm run build / node i18n/build.js) that produces one HTML
site and one PDF per language in one pass, plus an in-page language
switcher styled like the existing theme picker. npm run serve builds
and serves the multi-language output for local testing, since plain
mdbook serve only serves one language at the site root and 404s on
switcher links.

Translations don't need to be 1:1 with English: any missing page or
image is filled in from English for the duration of a language's
build (and never overwrites a real translation), so an incomplete
translation still builds instead of breaking. The language switcher
also checks a page actually exists before navigating to it, falling
back to that language's home page instead of a 404.

See i18n/README.md.
@FreeProject089

Copy link
Copy Markdown
Author

Quick update on this:

Reverted the GITHUB_TOKEN/CNAME commit, both workflows are back to using GH_PAGES_DEPLOY_BOT_PAT and the original custom domain.
Reworked the language switcher and the build script so neither assumes translations are 1:1 anymore: the switcher checks the target page actually exists before navigating (falls back to that language's home page otherwise), and the build fills in any missing file from English for that specific page instead of breaking or 404ing.
Images with embedded text are still on my list, not done yet.
I'm going to learn Python so I can port the build script over, but for now I'm leaving it in npm/JS.

@Zabuzard

Copy link
Copy Markdown
Member

@FreeProject089 Hey there, so I am back with a decision by the team. First of all, thanks again for all your efforts 👌
The team unfortunately decided against supporting your french translations officially for now. Reasons being:

  • AI based translation - so quality is always a bit of a concern for offering it "officially" and browser based "translate this website" features might result in similar quality already anyways
  • we dont have any person in our "inner circle" dedicated to supporting the french translations going forward

However, we are very interested in your contributions towards having the manual support a language-switching feature. We have a chinese manual already and will probably also get a korean one. They will benefit a lot from this feature.

And who knows, maybe someone shows up who wants to translate the manual into french per hand as well, including future support? Plus the other HB UIs and the keybinds. (This invitation goes out to everyone ofc, you included 🙂)

Either case, you are more than welcome to offer your french translations from your fork to everyone. Im sure the french community would appreciate it.

@FreeProject089

Copy link
Copy Markdown
Author

Thank you for your feedback and for taking the time to discuss this with the team.

I completely understand your decision and the reasons mentioned, especially regarding long-term maintenance of the translation and quality concerns.

I am, however, very happy that the i18n part and the language-switching system are of interest to you.

Regarding the French translation, I will continue to provide it from my fork for the French-speaking community. I will also continue maintaining it and making corrections when necessary to further improve its quality, even though the current version is already in a fairly clean state.

For information, the translation process was done as follows: the manual's .md files were first extracted into .txt files using a script to make the processing easier. An initial translation was then created with the help of translation tools, after which each file was fully reviewed and corrected before being converted back into its original .md format, while keeping the same structure and formatting as the original manual.

Thank you again for your feedback!

This branch has not been deployed

No deployments
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.

2 participants