Skip to content

Language support is broken - .mo files not bundled with this theme's wheel #584

Closed
@whyjz

Description

@whyjz

Describe the bug

context and bug
The language support seems not working (or partially working) now when used together with Jupyter Book. No matter what language is set in _config.yml, for example:

sphinx:
  config:
    language: fr

There will still be many words remaining untranslated (i.e. in English). Based on the following example, it seems that it used to work but not anymore.

Likely diagnosis of problem

There are potentially two problems:

  1. .mo files are not bundled with this theme. For example, in this pre-release there are generated language files in theme/sphinx_book_theme/static/locales/ but they are only .po and not .mo.

    Here's where the compilation happens:

    # compile mo
    for path in (out_folder / "locales").glob("**/booktheme.po"):
    print(path)
    subprocess.check_call(
    [
    "msgfmt",
    os.path.abspath(path),
    "-o",
    os.path.abspath(path.parent / "booktheme.mo"),
    ]
    )

    It isn't clear why this is happening - the only thing I can think of is that the glob isn't picking up the .po files at the end only in the build job for some reason? They are there when I build it locally.

  2. Some theme wording has likely changed. For example, Toggle primary sidebar is (I think) a new phrase that is not in our inventory of language translation phrases. We should find the new phrases that aren't there, and add them via the instructions in that readme.

Reproduce the bug

I forked a Jupyter Book written in French (associated Github repo) and pushed the book to my Github pages (associated Github repo) using exactly the same Github Action.

Screenshot from the original Book pages (last push was on Dec 8, 2021)
1

Screenshot from the forked Book pages (last push was on Jul 10, 2022)
2

You can see while some of the words are translated (e.g. Suivant and juil.), many others are not (Last updated, By, ...).

@pnavaro I would like to ping you here since I used your book as a test case. Maybe you also have some ideas about this?

List your environment

Latest version on conda in Dec 8, 2021 vs Jul 10, 2022.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions