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

Misleading doc of locale argument defaults #542

Closed
xmo-odoo opened this issue Nov 12, 2017 · 2 comments
Closed

Misleading doc of locale argument defaults #542

xmo-odoo opened this issue Nov 12, 2017 · 2 comments

Comments

@xmo-odoo
Copy link
Contributor

Looking at the API doc for e.g. format_datetime, I just noticed that it states the default value for the locale parameter is 'en_US_POSIX'. That is very misleading as it actually uses the result of babel.core.default_locale('LC_TIME') which may not be anything like en_US_POSIX (and just happens to be so on the machine which built the documentation).

This can be fixed by providing an explicit signature as first line of the docstring (which will replace the extracted one) but I don't know that this is the fix the project would expect.

Please advise.

@akx
Copy link
Member

akx commented Jan 15, 2018

Hi,

Yeah, you're correct that that's kind of misleading :( An explicit signature would be fine.

To be honest – and this is probably something that'd need to be implemented in Babel 3 – I think default_locale('LC_...') should be a lazy object that checks the current value of the envvar whenever invoked; otherwise (i.e. currently) runtime changes to the envvar won't get properly applied anyway.

@xmo-odoo
Copy link
Contributor Author

I created a PR with the explicit autofunction signature. Though it only fixes the functions of the first section (Date and Time Formatting) despite the doc having other functions with an LC_TIME parameter.

@akx akx closed this as completed in 57832c6 Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants