Commit Graph

43 Commits

Author SHA1 Message Date
R. David Murray a83da3507f Fix issue 2522. locale.format now checks that it is passed
exactly one pattern, which avoids mysterious errors where it
had seemed to fail to do localization.
2009-04-01 03:21:43 +00:00
Antoine Pitrou 7c33bd5ecb Attempt to fix Solaris buildbot failure on test_locale 2009-03-18 17:10:04 +00:00
Antoine Pitrou feeafff052 Issue #1222: locale.format() bug when the thousands separator is a space character. 2009-03-14 00:07:21 +00:00
Antoine Pitrou ba54edadb3 convert test_locale to unittest, and add a mechanism to override localconv() results for further testing (#1864, #1222) 2008-07-25 20:40:19 +00:00
Marc-André Lemburg adff65bc3e Update the locale module alias table.
Closes #3011.
2008-05-30 20:52:18 +00:00
Georg Brandl 09728b7ef3 Patch #1710352: add missing public functions to locale.__all__. 2007-05-01 06:08:15 +00:00
Tim Peters fd4c419332 Whitespace normalization. 2006-05-18 02:06:40 +00:00
Georg Brandl b89316fdbf Patch #1180296: improve locale string formatting functions 2006-05-17 15:51:16 +00:00
Tim Peters 777f1083ef Whitespace normalization. 2006-01-20 20:03:24 +00:00
Georg Brandl 5035c1c557 Readd bug report note. 2006-01-20 13:38:26 +00:00
Georg Brandl b709c2caba Bug #1371247: Update Windows LCIDs in locale.py. 2006-01-20 09:07:35 +00:00
Matthias Klose f3f231f60c - Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE
to get the correct encoding.

- Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of
  languages.
2005-09-20 07:02:49 +00:00
Raymond Hettinger 346e67f805 SF patch #1051395: locale.getdefaultlocale does not return tuple in some OS
(Contributed by Jiwon Seo.)
2005-01-01 06:10:26 +00:00
Marc-André Lemburg b4cebd465a Correct mapping of Python codec name to C encoding name for UTF-8 (the C lib
doesn't seem to like "UTF-8").

Removed the UTF-8 aliases since these should be available for all locales.
2004-12-13 19:56:01 +00:00
Marc-André Lemburg bb4f1bdd8b locale.py now uses an updated locale alias table (built using
Tools/i18n/makelocalealias.py, a tool to parse the X11 locale
alias file); the encoding lookup was enhanced to use Python's
encoding alias table

As sige-effect, this fixes SF bug [ 1080864 ] locale.py doesn't recognize
valid locale setting.
2004-12-10 21:58:14 +00:00
Martin v. Löwis c8ae31dcbd Patch #962487: Don't crash for empty locale names. 2004-07-26 12:45:18 +00:00
Skip Montanaro 249369c7f0 atof: correct parameter name 2004-04-10 16:39:32 +00:00
Brett Cannon aaeffaf01e Replace sequential split/join calls on strings with a single replace call.
Thanks Andrew Gaul.
2004-03-23 23:50:17 +00:00
Martin v. Löwis 103d6e7a3c Support '' as the argument for the setlocale emulation. Fixes #678259. 2003-03-30 15:42:13 +00:00
Tim Peters 230a60c6ec Whitespace normalization. 2002-11-09 05:08:07 +00:00
Tim Peters a326f47a13 This stopped working on Windows, due to a reference to the non-existent
_locale.getdefaultlocale.  Guessing a leading underscore was intended,
but don't really understood this stuff (locale looks like Spanish for
the opposite of global to me <wink>).
2002-11-05 03:49:09 +00:00
Martin v. Löwis f0a4668e6f Add getpreferredencoding. Support @euro modifiers. Fixes #554676.
The @euro part is backported to 2.2.3.
2002-11-03 17:20:12 +00:00
Fredrik Lundh 37a0982278 point people to the Python bug tracker, rather than to a mail
account I hardly ever use...
2002-10-19 20:19:10 +00:00
Skip Montanaro 0897f0c4f8 eliminate unqualified except when checking for presence of LC_MESSAGES
see bug 411881
2002-03-25 21:40:36 +00:00
Andrew M. Kuchling 1f877ef199 Remove some dead code (PyChecker) 2001-08-13 14:50:44 +00:00
Guido van Rossum 67addfe2a8 Implement Mark Favas's suggestion. There's a clear bug in _group():
its first return statement returns a single value while its caller
always expects it to return a tuple of two items.  Fix this by
returning (s, 0) instead.

This won't make the locale test on Irix succeed, but now it will fail
because of a bug in the platform's en_US locale rather than because of
a bug in the locale module.
2001-04-16 16:04:10 +00:00
Martin v. Löwis 88ad12afac Patch #415777: new grouping strategy.
fixes bug #414940, and redoes the fix for #129417 in a different way.
It also fixes a number of other problems with locale-specific formatting:
If there is leading or trailing spaces, then no grouping should be applied
in the spaces, and the total length of the string should not be changed
due to grouping.
Also added test case which works only if the en_US locale is available.
2001-04-13 08:09:50 +00:00
Barry Warsaw 7519e7af42 setlocale(): In _locale-missing compatibility function, string
comparison should be done with != instead of "is not".
2001-03-23 17:00:07 +00:00
Eric S. Raymond be9b507bdd String method conversion. 2001-02-09 10:48:30 +00:00
Tim Peters 1baf829835 test___all__ was failing on WIndows because locale.py doesn't really
know which names it exports.  Didn't fix its ignorance, but patched
over the consequence.
2001-01-24 10:13:46 +00:00
Skip Montanaro 17ab123cf1 a few more modules get __all__ 2001-01-24 06:27:27 +00:00
Martin v. Löwis db786876b6 In format(), consider sign only after grouping.
Suggested by Kevin Jacobs in bug report #129417.
2001-01-21 18:52:33 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Fredrik Lundh 663809ed83 -- removed get_default compatibility kludge
-- added a few extra comments to locale.py
2000-07-10 19:32:19 +00:00
Fredrik Lundh 0466132ee4 - repaired locale.py for non-windows platforms. the try/except
checked for the wrong exception.  my fault.  sorry.
  (first reported by Alex Coventry)
2000-07-09 23:16:10 +00:00
Fredrik Lundh 6c86b99dc1 - merged setlocale and set_locale. the internal setlocale
function is overridden by a python version which accepts
  *either* a string (old behaviour) or a locale tuple.

- renamed a few methods (for consistency):

        get_locale => getlocale
        get_default_locale => getdefaultlocale
        set_to_default => resetlocale (!)

- the _locale implementation module can now implement
  an optional _getdefaultlocale function.  if that function
  isn't available, a POSIX-based approach is used (checking
  LANG and other environment variables, as usual).

(patch #100765)
2000-07-09 17:12:58 +00:00
Jeremy Hylton a05e293a21 typos fixed by Rob Hooft 2000-06-28 14:48:01 +00:00
Marc-André Lemburg 2348114ba8 Marc-Andre Lemburg <mal@lemburg.com>:
Added emulations of the C APIs in _locale to be used when the
_locale module is not enabled. They return the correct values
assuming the 'C' locale.
2000-06-08 17:49:41 +00:00
Marc-André Lemburg 5431bc3602 Marc-Andre Lemburg <mal@lemburg.com>:
Added a new locale name aliasing engine which also supports
locale encodings, a feature which is used by the new default
encoding support in site.py.
2000-06-07 09:11:40 +00:00
Guido van Rossum 4b8c6eaf8b Actually, the previous batch's comment should have been different;
*this* set of patches is Ka-Ping's final sweep:

The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.

A new docstring was added to formatter.  The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
2000-02-04 15:39:30 +00:00
Guido van Rossum 45e2fbc2e7 Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
Guido van Rossum bd1169a93e Add Martin von Loewis as the author of this module. 1997-11-19 19:02:09 +00:00
Guido van Rossum eef1d4e8b1 User-level locale module. A wrapper around _locale which adds
format(), str(), atof(), and atoi().  The last three are locale
sensitive versions of the corresponding standard functions (only for
numbers though); format() does general %[efg] formatting taking the
locale into account, optionally with thousands grouping.
1997-11-19 19:01:43 +00:00