Skip to content

locale_dirs default value inconsistency #13025

@rffontenelle

Description

@rffontenelle

Describe the bug

sphinx-build searches for translation files in the directory 'locale', even though
locale_dirs conf value defaults to 'locales' since Sphinx 1.5, as per changelog entry.

This causes weird behaviors like sphinx-intl looking for translations in 'locales' (sphinx-doc/sphinx-intl#14), but sphinx-build builds translated docs using translations from 'locale'.

Related code (I think, not sure though):

locale_dirs += [path.join(package_dir, 'locale')]

'locale_dirs': _Opt(['locales'], 'env', ()),

How to Reproduce

# Get sphinx and sphinx-doc-translations sources
git clone --single-branch --depth 1 --branch 3.13 https://github.com/python/cpython
git clone --single-branch --depth 1 --branch 3.13 https://github.com/python/python-docs-pt-br cpython/Doc/locale/pt_BR/LC_MESSAGES
# Enter sphinx dir
cd cpython/Doc
# Build translated from locale
make html SPHINXOPTS='-Dlanguage=pt_BR'
# and check built files, should be translated
# Now rename directory
mv locale locales
# Again build translated from locale
make html SPHINXOPTS='-Dlanguage=pt_BR'
# and check the built files, which should NOT be translated now.

Environment Information

Latest sphinx commit

Sphinx extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions