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

Add tool which can build translations for all available languages #13

Open
mgeisler opened this issue Apr 4, 2023 · 4 comments · May be fixed by #84
Open

Add tool which can build translations for all available languages #13

mgeisler opened this issue Apr 4, 2023 · 4 comments · May be fixed by #84
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mgeisler
Copy link
Collaborator

mgeisler commented Apr 4, 2023

The mdbook-gettext preprocessor translates a book into a single language. To translate your book into all available languages, you need to build a look yourself. An example of this can be found in the publish.yml GitHub action for Comprehensive Rust 🦀:

      - name: Build all translations
        run: |
          for po_lang in ${{ env.LANGUAGES }}; do
              echo "::group::Building $po_lang translation"
              MDBOOK_BOOK__LANGUAGE=$po_lang \
              MDBOOK_OUTPUT__HTML__SITE_URL=/comprehensive-rust/$po_lang/ \
              mdbook build -d book/$po_lang
              echo "::endgroup::"
          done

We should make this easier somehow. Idea:

  • Build a small command line tool (perhaps called mdbook-i18n) where mdbook-i18n build would do the looping seen above.
@mgeisler mgeisler added the enhancement New feature or request label Apr 4, 2023
@simonsan
Copy link

simonsan commented Apr 5, 2023

Maybe related with upstream mdbook?

rust-lang/mdBook#2029

@mgeisler
Copy link
Collaborator Author

mgeisler commented Apr 6, 2023

Maybe related with upstream mdbook? rust-lang/mdBook#2029

Yes, partially: @jooyunghan also works in Android and made the PR to simplify our translation infrastructure.

Here, I was thinking of making a small stand-alone tool which can do all the looping we need to implement translations. It would

  • call MDBOOK_BOOK__LANGUAGE=xx mdbook build for all languages.
  • it would generate the language picker drop-down and inject this into the generated HTML (or theme or similar).

I think that approach would be more flexible than trying to teach mdbook all this.

@mgeisler
Copy link
Collaborator Author

mgeisler commented Sep 26, 2023

Hey @sakex, I assigned this to you since this is basically what you're doing in #84. So you should update the PR to say "Fixes #13" so it will close this one automatically.

@mgeisler
Copy link
Collaborator Author

Note that I've made implementing this issue a bit more complicated with google/comprehensive-rust#1243: you'll need to use Git library to update the src/ folder to the right version.

On the other hand, this feature makes the backend here much more useful: instead of replacing a small for-loop, it can now replace more complex logic! This makes this renderer more relevant and useful for everybody.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants