Skip to content

gh-134887: Add references to locale module for locale-aware number formatting references in string module docs #134888

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stefmolin
Copy link

@stefmolin stefmolin commented May 29, 2025

Add references to locale module for locale-aware number formatting references in string module docs to avoid users thinking that the locale doesn't have a thousands separator for example.

@python-cla-bot
Copy link

python-cla-bot bot commented May 29, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app bedevere-app bot added docs Documentation in the Doc dir skip news labels May 29, 2025
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs May 29, 2025
@stefmolin stefmolin changed the title Add references to locale module for locale-aware number formatting references in string module docs gh-134888: Add references to locale module for locale-aware number formatting references in string module docs May 29, 2025
@stefmolin stefmolin marked this pull request as ready for review May 29, 2025 14:15
@stefmolin stefmolin changed the title gh-134888: Add references to locale module for locale-aware number formatting references in string module docs gh-134887: Add references to locale module for locale-aware number formatting references in string module docs May 29, 2025
For a locale aware separator, use the ``'n'`` presentation type instead.
For a locale-aware separator, use the ``'n'`` presentation type instead. Note
that the locale setting for numeric values must first be set using the
:mod:`locale` module, *e.g.,* ``locale.setlocale(locale.LC_NUMERIC, 'en_US')``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

@stefmolin stefmolin May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two other occurrences of "e.g." in this document that pre-date my changes. Would you like me to update those as well?

Copy link
Member

@ericvsmith ericvsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we need to add a reference to setting the locale, since the text already says it's local aware.

For a locale-aware separator, use the ``'n'`` presentation type instead.
Note that the locale setting for numeric values must first be set using
the :mod:`locale` module, for example,
``locale.setlocale(locale.LC_NUMERIC, 'en_US')``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why refer to this here? At most it just belongs in the n section.

| | digit group separators. |
| | digit group separators. Note that the default locale is |
| | not the system locale, and therefore, you must set, at a |
| | minimum, the ``LC_NUMERIC`` category (see the |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't true, is it? I'm referring to the wording "must set": shouldn't it be "can set".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

4 participants