-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-87281: Improve documentation for locale.setlocale() and locale.getlocale() #137313
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
base: main
Are you sure you want to change the base?
Conversation
Reference to RFC 1766 was incorrect -- RFC 1766 specifies language and territory separated by a minus instead of underscore, and it does not contain much useful information anyway. Also,
Added specification of universally accepted formats. Late |
Doc/library/locale.rst
Outdated
name using the locale aliasing engine. An empty string specifies the user's | ||
default settings. If the modification of the locale fails, the exception | ||
:exc:`Error` is raised. If successful, the new locale setting is returned. | ||
|
||
The format of the *locale* and the language code strings is platform | ||
depended, but the forms ``language[_territory][.encoding][@modifier]`` | ||
and ``language[_territory]`` respectively are typically accepted on all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and ``language[_territory]`` respectively are typically accepted on all | |
and ``language[_territory]`` are typically accepted on all |
I'm not sure what this is referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It refers to the locale and the language code strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is not clear, we can only specify format for locale, and then say that the language code has the same format, but without encoding and modifier (support for modifiers will be added in #137253).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd write: "the form language[_territory][.encoding][@modifier]
is typically accepted".
The second version you mention is already included in this.
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your grammar fixes @StanFromIreland.
Doc/library/locale.rst
Outdated
name using the locale aliasing engine. An empty string specifies the user's | ||
default settings. If the modification of the locale fails, the exception | ||
:exc:`Error` is raised. If successful, the new locale setting is returned. | ||
|
||
The format of the *locale* and the language code strings is platform | ||
depended, but the forms ``language[_territory][.encoding][@modifier]`` | ||
and ``language[_territory]`` respectively are typically accepted on all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It refers to the locale and the language code strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo the small change requests.
Doc/library/locale.rst
Outdated
name using the locale aliasing engine. An empty string specifies the user's | ||
default settings. If the modification of the locale fails, the exception | ||
:exc:`Error` is raised. If successful, the new locale setting is returned. | ||
|
||
The format of the *locale* and the language code strings is platform | ||
depended, but the forms ``language[_territory][.encoding][@modifier]`` | ||
and ``language[_territory]`` respectively are typically accepted on all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd write: "the form language[_territory][.encoding][@modifier]
is typically accepted".
The second version you mention is already included in this.
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
📚 Documentation preview 📚: https://cpython-previews--137313.org.readthedocs.build/