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

Initial support for translations #32

Closed
wants to merge 6 commits into from

Conversation

petebankhead
Copy link
Contributor

Hi @bethac07

Could you check out this PR please?

It's based on #30 and your gist, with some differences described below.

One language file for everything

To avoid having to manage multiple .pot files and then exclude some, I've put everything into book.pot.

Location of language files

  1. Translations are added to locales instead of locale, because this is now the default for locale_dirs.
  2. Catalogues are added to locales/_build rather than _build - because this means that jb clean . --all doesn't cause havoc (since it just deletes _build)

Adding and updating languages

A new helpers/translate.py has been added to simplify managing conf.py, adding and updating languages.

# Create a conf.py - and don't delete it afterwards
python helpers/translate.py --create-config --overwrite

# Update languages
# This can use existing conf.py or create one temporarily
python helpers/translate.py --update

# Update languages and add Spanish and Portuguese languages
# (This is equivalent to translate.py --update --lang es --lang pt)
python helpers/translate.py --lang es --lang pt

The JB config was updated to avoid (hopefully) the need for manual edits to the automatically generated conf.py.

Based on bioimagebook#30
Make changes to `_config.yml` that simplify adding support for other languages.
Introduce `create_conf.py` to handle the remaining `conf.py` customization needed beyond what Jupyter Book can create itself.
@bethac07
Copy link
Contributor

bethac07 commented Feb 5, 2024

Awesome, thank you for writing the automation bits, that had been sitting in my queue for quite a bit! You're a prince.

Up to you, and it's honestly likely a matter of personal preference - tech-stack wise, having one POT is obviously easier. But I worry that it may end up being a bit disspiriting to have all nearly 3K strings/80K to translate in one file - going through in the interface, when the number of strings in an individual file is smaller, you can at least see that you're making progress. With only one file, even though it's the same amount of translation, it may feel more overwhelming for our volunteers to take on. But I don't think there's a "right" answer here. But as a point of feedback, our book is about 20% the size of yours, and we've already gotten the feedback that it feels like it is a lot to take on, so going away from compact may help make it feel like each page is an approachable bite size. Then again, you have things broken into a lot more discrete files than we do, so the just overall file list being long may be worse! 🤷‍♀️ But certainly I "approve" this PR ("adore" is really a better word), just something to think about.

image

@petebankhead
Copy link
Contributor Author

Thanks! What do you think of #33 ?

tbh I merged everything since your original PR had all the chapters merged, and they were the important bit. I've no idea what it looks like once it's in Transifex, but I can imagine I'd feel more motivated with more short files rather than one huge file. Also, the book should make some kind of sense one chapter or part at a time.

So, I can either merge this PR or #33 - I'd rather defer to your expertise on which it should be :) Based on your post, if we think Transifex can cope then I'd tend towards the many smaller files.

@bethac07
Copy link
Contributor

bethac07 commented Feb 5, 2024

I think merge 33! I asked internally and that was the 3/3 consensus (and my own). Sorry for not thinking of it originally!

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