sphinx-doc/sphinx-intl

sphinx-intl is using the relative path to cwd not conf.py

12rambau opened this issue · 3 comments

I'm using nox to build most of my automated process now and that include generating the translation .pot files for my documentation.

Before I was running:

cd docs 
sphinx-intl update -p build/gettext -l fr -l en

now I would like to run it from the root of my repository as:

sphinx-intl update -p docs/build/gettext -l fr -l en

When I do the last one, the conf.py file is not detected and all my pot files are saved in a default locales directory even though I use _locale in my conf.py.

Is it possible to specify the location of the conf.py file to the command ? If not, could we add this option ?

Please use -c option like:

sphinx-intl -c docs/conf.py update -p docs/build/gettext -l fr -l en

FYI:

$ sphinx-intl --help       
Usage: sphinx-intl [OPTIONS] COMMAND [ARGS]...

  Environment Variables: All command-line options can be set with environment
  variables using the format SPHINXINTL_<UPPER_LONG_NAME> . Dashes (-) have to
  replaced with     underscores (_).

  For example, to set the languages:

  export SPHINXINTL_LANGUAGE=de,ja

  This is the same as passing the option to txutil directly:

  sphinx-intl update --language=de --language=ja

Options:
  -c, --config <FILE>  Sphinx conf.py file to read a locale directory setting.
  -t, --tag <TAG>      Pass tags to conf.py, as same as passed to sphinx-build
                       -t option.
  --help               Show this message and exit.

Commands:
  build                      Build specified language's po files into mo.
  create-transifexrc         Create `$HOME/.transifexrc`
  create-txconfig            Create `./.tx/config`
  stat                       Print statistics for all po files.
  update                     Update specified language's po files from pot.
  update-txconfig-resources  Update resource sections of `./.tx/config`.

I checked the documentation and didn't found a trace of this option. If the Options are well set, would you consider using sphinxcontrib.autoprogram so that things f=can be found in the docs as well ?

@12rambau Well... I think documentation is certainly needed. sphinx-intl uses click, so I'll see if we can document it with sphinx-click.