]>
git.ipfire.org Git - thirdparty/babel.git/log
Tomas R. [Tue, 8 Jul 2025 10:16:34 +0000 (12:16 +0200)]
Use CLDR47 (#1210)
Aarni Koskela [Thu, 3 Jul 2025 14:02:16 +0000 (17:02 +0300)]
Make the number pattern regular expression more efficient (#1213)
I verified that all patterns parsed for importing CLDR data are parsed equivalently using the new regular expression.
The inefficient regular expression was brought to our attention by GitHub user s-sanskar – thanks!
Co-authored-by: s-sanskar <sanskarpok11@gmail.com>
Aarni Koskela [Mon, 30 Jun 2025 10:20:55 +0000 (13:20 +0300)]
Merge pull request #1174 from verhovsky: Remove u string prefix from docs
Boris Verkhovskiy [Fri, 24 Jan 2025 10:21:22 +0000 (03:21 -0700)]
Stop removing u prefix in doctest
Boris Verkhovskiy [Thu, 16 Jan 2025 10:45:05 +0000 (03:45 -0700)]
Escape unicode literals
Boris Verkhovskiy [Thu, 16 Jan 2025 10:43:20 +0000 (03:43 -0700)]
Convert unicode literals to characters
Boris Verkhovskiy [Thu, 16 Jan 2025 10:31:06 +0000 (03:31 -0700)]
Remove u string prefix
Aarni Koskela [Tue, 24 Jun 2025 11:53:27 +0000 (14:53 +0300)]
Keep translator comments next to the translation function call (#1196)
* Add reproducer for issue 1195
* Keep translator comments next to the translation function call, even if the text is further away
Fixes #1195
Aarni Koskela [Tue, 24 Jun 2025 06:41:50 +0000 (09:41 +0300)]
Use pathlib.Path() in catalog frontend; improve test coverage (#1204)
Aarni Koskela [Sat, 5 Apr 2025 15:21:04 +0000 (18:21 +0300)]
Optimizations for read_po (#1200)
* Avoid extra casts (`Message()` takes care of those)
* Optimize empty normalized strings
* Don't sort translations unless plural
* Optimize unescape()
* Optimize line processing
* Optimize keyword parsing
* Optimize comment parsing
* Avoid hot `isinstance`ing in PO file parse loop
* Add fast paths in `python_format` and `python_brace_format`
* Inline distincting in `catalog.py`
Aarni Koskela [Fri, 21 Mar 2025 06:18:16 +0000 (08:18 +0200)]
Use standard library `timezone` instead of `FixedOffsetTimezone` (#1203)
Aarni Koskela [Mon, 17 Mar 2025 13:05:00 +0000 (15:05 +0200)]
Improve handling of no-inheritance-marker in timezone data (#1194)
* Add icu4c-tools
* Improve handling of no-inheritance-marker in timezone data
Fixes #1192 (but uncovers another bug)
Tomas R. [Fri, 7 Mar 2025 14:53:51 +0000 (15:53 +0100)]
Check all plurals in python format checker (#1188)
Aarni Koskela [Wed, 5 Mar 2025 07:18:05 +0000 (09:18 +0200)]
Mark PyPy test failing in CI as xfail (#1197)
clach04 [Wed, 5 Mar 2025 07:17:06 +0000 (23:17 -0800)]
Update dates.rst with current unicode.org tr35 link (#1189)
Aarni Koskela [Wed, 5 Mar 2025 06:56:51 +0000 (08:56 +0200)]
Try to fix PyPy CI flake
Tomas R. [Wed, 5 Feb 2025 09:33:01 +0000 (10:33 +0100)]
Move pytest config to pyproject.toml (#1187)
Tomas R. [Wed, 5 Feb 2025 09:31:58 +0000 (10:31 +0100)]
Add more classifiers (#1186)
Aarni Koskela [Wed, 5 Feb 2025 08:41:58 +0000 (10:41 +0200)]
Avoid unnecessary uses of `map()` (#1180)
Aarni Koskela [Mon, 3 Feb 2025 09:06:48 +0000 (11:06 +0200)]
Fix formatting for "Empty locale identifier" exception added in #1164 (#1184)
Aarni Koskela [Sat, 1 Feb 2025 15:13:46 +0000 (17:13 +0200)]
Prepare for 2.17.0 (#1182)
* Update authors
* Update changelog
* Update copyright dates
* Update version
Tomas R. [Fri, 31 Jan 2025 13:23:34 +0000 (14:23 +0100)]
Increase test coverage of the `python_format` checker (#1176)
Jun Omae (大前 潤) [Fri, 31 Jan 2025 13:22:06 +0000 (22:22 +0900)]
Fix dates formatting `Y`, `w` and `W` symbols for week-numbering (#1179)
Aarni Koskela [Wed, 29 Jan 2025 08:06:34 +0000 (10:06 +0200)]
Merge pull request #1173 from python-babel/lc-monetary-2
Prefer LC_MONETARY when formatting currencies
Aarni Koskela [Thu, 21 Dec 2023 23:42:55 +0000 (00:42 +0100)]
Prefer LC_MONETARY when formatting currency
Co-authored-by: Alexis Hildebrandt <afh@surryhill.net>
Aarni Koskela [Tue, 14 Jan 2025 14:32:22 +0000 (16:32 +0200)]
`default_locale`: support multiple keys
Also ignore falsy values in `default_locale` args.
Tomas R. [Sat, 25 Jan 2025 08:48:00 +0000 (09:48 +0100)]
Import `Literal` & `TypedDict` from the typing module (#1175)
* Import 'Literal' from the typing module
* Import 'TypedDict' from the typing module
Tomas R. [Thu, 16 Jan 2025 11:09:32 +0000 (12:09 +0100)]
Add basic support for `Message.python_brace_format` (#1169)
Aarni Koskela [Wed, 15 Jan 2025 13:01:58 +0000 (15:01 +0200)]
Small test cleanup (#1172)
* Configure Ruff formatter to preserve quotes for now
* Split support functionality tests to a separate modules
* Use standard `monkeypatch` fixture for `os.environ` patching
* Use even more `monkeypatch` for patching
---------
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Aarni Koskela [Tue, 14 Jan 2025 13:56:19 +0000 (15:56 +0200)]
Merge pull request #1170 from python-babel/small-cleanup
Small cleanups
Aarni Koskela [Tue, 14 Jan 2025 07:52:14 +0000 (09:52 +0200)]
Add test to cover `force_text` fully
Aarni Koskela [Mon, 13 Jan 2025 11:49:30 +0000 (13:49 +0200)]
Refresh docs for extraction method registration
Aarni Koskela [Mon, 13 Jan 2025 11:40:23 +0000 (13:40 +0200)]
Replace dead or insecure links
Aarni Koskela [Mon, 13 Jan 2025 11:38:46 +0000 (13:38 +0200)]
Un-shadow types in `support`
Aarni Koskela [Mon, 13 Jan 2025 11:54:56 +0000 (13:54 +0200)]
Apply minor simplifications
Aarni Koskela [Mon, 13 Jan 2025 11:28:58 +0000 (13:28 +0200)]
Fix minor pep8 complaints
Aarni Koskela [Mon, 13 Jan 2025 11:25:41 +0000 (13:25 +0200)]
Simplify `Catalog._get_mime_headers()`
Aarni Koskela [Mon, 13 Jan 2025 11:20:52 +0000 (13:20 +0200)]
Make `_force_text` a free function
Aarni Koskela [Mon, 13 Jan 2025 11:18:34 +0000 (13:18 +0200)]
Be less fancy in `_PluralTuple`
Aarni Koskela [Mon, 13 Jan 2025 11:16:18 +0000 (13:16 +0200)]
Fix up some docstrings
Aarni Koskela [Mon, 13 Jan 2025 11:10:48 +0000 (13:10 +0200)]
Ensure imported names are in __all__; sort __all__s
Aarni Koskela [Mon, 13 Jan 2025 11:10:02 +0000 (13:10 +0200)]
Upgrade Ruff
Tomas R. [Mon, 13 Jan 2025 11:50:16 +0000 (12:50 +0100)]
Remove redundant assignment (#1167)
Aarni Koskela [Fri, 10 Jan 2025 06:17:02 +0000 (08:17 +0200)]
Strip extra leading slashes in `/etc/localtime` (#1165)
* Strip extra leading slashes in `/etc/localtime`
Fixes #990
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Aarni Koskela [Thu, 9 Jan 2025 12:44:36 +0000 (14:44 +0200)]
Use `pytest.raises(match=...)` (#1166)
Aarni Koskela [Thu, 9 Jan 2025 12:41:38 +0000 (14:41 +0200)]
Merge pull request #1164 from python-babel/locale-none
Improve handling for `locale=None`
Aarni Koskela [Thu, 9 Jan 2025 08:30:09 +0000 (10:30 +0200)]
Mark `babel.lists.DEFAULT_LOCALE` as deprecated
Aarni Koskela [Wed, 8 Jan 2025 14:23:08 +0000 (16:23 +0200)]
Unify `str | Locale | None` to `Locale | str | None`
Aarni Koskela [Wed, 8 Jan 2025 13:37:19 +0000 (15:37 +0200)]
Raise a more specific error if `Locale.parse()` is passed an empty value
Aarni Koskela [Wed, 8 Jan 2025 13:52:53 +0000 (15:52 +0200)]
Defer lookups of default locale values
Aarni Koskela [Wed, 8 Jan 2025 13:57:55 +0000 (15:57 +0200)]
Remove defaults from internal `_format_currency_long_name`'s args; remove unused arg
Aarni Koskela [Wed, 8 Jan 2025 13:16:10 +0000 (15:16 +0200)]
Support short and narrow formats for format_timedelta(..., add_direction=True) (#1163)
Fixes #1162
wandrew004 [Wed, 8 Jan 2025 12:37:54 +0000 (07:37 -0500)]
Add tzdata as dev dependency; move dev deps to pyproject.toml (#1159)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Tomas R. [Tue, 10 Dec 2024 06:50:13 +0000 (07:50 +0100)]
Prevent wrapping file locations containing white space (#1120)
Co-authored-by: Aarni Koskela <akx@iki.fi>
James McKinney [Mon, 9 Dec 2024 14:39:49 +0000 (09:39 -0500)]
fix(extract): use the first matching method and options (#1121)
... instead of the first matching method and last matching options.
Co-authored-by: Aarni Koskela <akx@iki.fi>
Aarni Koskela [Mon, 9 Dec 2024 13:47:43 +0000 (15:47 +0200)]
Bump CI/tool versions (#1160)
* CI: use Ubuntu 24.04 and macOS 14 for tests
* CI: update codecov-action version
* Update lint tools; fix issues
Tomas R. [Mon, 9 Dec 2024 12:35:24 +0000 (13:35 +0100)]
Simplify read_mo logic (#1148)
Tomas R. [Mon, 9 Dec 2024 12:11:12 +0000 (13:11 +0100)]
Allow specifying an explicit format in parse_date/parse_time (#1131)
* Allow specifying an explicit format in parse_date/parse_time
* Improve docstring
Tomáš Hrnčiar [Mon, 9 Dec 2024 12:05:34 +0000 (13:05 +0100)]
Adjust docs/conf.py to add compatibility with sphinx 8 (#1155)
Fixes: #1143
Tomas R. [Mon, 9 Dec 2024 12:03:12 +0000 (13:03 +0100)]
Update CI to use Python 3.13 and Ubuntu 24.04 (#1153)
Tomas R. [Fri, 15 Nov 2024 12:23:05 +0000 (13:23 +0100)]
Use CLDR 46 (#1145)
* Use CLDR 46
* Update checksum
* Add tests for units
* Add a test for alt='official'
* Fix formatting
Tomas R. [Sun, 10 Nov 2024 20:39:04 +0000 (21:39 +0100)]
Replace OrderedDict with just dict (#1149)
Tomas R. [Sun, 20 Oct 2024 06:54:27 +0000 (08:54 +0200)]
Fix the way obsolete messages are stored (#1132)
Aarni Koskela [Sun, 20 Oct 2024 06:52:07 +0000 (09:52 +0300)]
Mark `wraptext` deprecated; use `TextWrapper` directly in `write_po` (#1140)
* Mark `wraptext` deprecated; use `TextWrapper` directly in `write_po`
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Tomas R. [Sun, 20 Oct 2024 06:50:36 +0000 (08:50 +0200)]
Make seconds optional in `parse_time` time formats (#1141)
Gabe Sherman [Sat, 19 Oct 2024 12:33:39 +0000 (06:33 -0600)]
PO files: Consider a message without a translation to have an empty translation (#1135)
Fixes an index out of bounds error in add_message.
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
mattdiaz007 [Sat, 19 Oct 2024 12:21:51 +0000 (08:21 -0400)]
Delete duplicate code in test (#1138)
Dylan Kiss [Sat, 19 Oct 2024 12:17:36 +0000 (14:17 +0200)]
Fix extracted lineno with nested calls (#1126)
When a gettext call had a nested function call on a new line, the
extract function would use that nested call's line number when
extracting the terms for the gettext call.
The reason is that we set the line number on any encounter of an opening
parenthesis after a gettext keyword. This does not work if either we
have a nested call, or our first term starts on a new line.
This commit fixes that by only setting the line number when we encounter
the first argument inside a gettext call.
Existing tests were adapted to work according to `xgettext` with regards
to the line numbers.
Fixes https://github.com/python-babel/babel/issues/1123
Tomas R. [Sat, 19 Oct 2024 12:12:50 +0000 (14:12 +0200)]
Replace more alternate characters in format_skeleton (#1122)
Replaces some additional characters which never appear in resource files before matching the skeleton. This replicates the behaviour of ICU.
Tomas R. [Sat, 19 Oct 2024 12:01:58 +0000 (14:01 +0200)]
Bugfix: Replace str.index with str.find (#1130)
Daniel Roschka [Wed, 4 Sep 2024 15:58:12 +0000 (17:58 +0200)]
Enclose white spaces in references (#1105)
Since version 0.22 gettext encloses file names in references which
contain white spaces or tabs within First Strong Isolate (U+2068) and
Pop Directional Isolate (U+2069). This commit adds the same behavior for
Babel.
Tomas R [Wed, 28 Aug 2024 09:39:46 +0000 (11:39 +0200)]
Fix deprecation warnings for datetime.utcnow() (#1119)
Aarni Koskela [Thu, 8 Aug 2024 12:45:14 +0000 (15:45 +0300)]
Prepare for 2.16.0 release (#1116)
Aarni Koskela [Wed, 7 Aug 2024 09:46:55 +0000 (12:46 +0300)]
Initial support for reading mapping configuration as TOML (#1108)
* Rename parse_mapping to parse_mapping_cfg and remove duplicated test
* Add initial support for TOML mapping configuration (prefer tomllib to tomli)
---------
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
buhtz [Wed, 7 Aug 2024 08:20:28 +0000 (10:20 +0200)]
Two hyperlinks (to CLDR) and some typos (#1115)
Aarni Koskela [Wed, 7 Aug 2024 08:14:34 +0000 (11:14 +0300)]
Do not allow substituting alternates or drafts in derived locales (#1113)
* download_import_cldr.py: pass remaining arguments through to import_cldr
* Do not allow substituting alternates or drafts in derived locales
For more coverage, we've allowed using alternate or draft values
when no officially accepted values have been present.
However, non-global (i.e. e.g. `de_CH` locales) may have an alternate
spelling for what would be an alternate in the parent locale (and
that alternate hasn't been imported into the parent), and the import
would have then accepted the alternate from the child locale as a
non-alternate.
Refs #1112
Aarni Koskela [Mon, 5 Aug 2024 15:11:10 +0000 (18:11 +0300)]
Normalize package name to lower-case in setup.py (#1110)
Fixes #1109.
Aarni Koskela [Thu, 25 Jul 2024 11:25:02 +0000 (14:25 +0300)]
Test on Python 3.13 beta releases (#1107)
* Test on Python 3.13 beta releases
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Aarni Koskela [Thu, 25 Jul 2024 09:51:43 +0000 (12:51 +0300)]
Allow use of importlib.metadata for finding entrypoints (#1102)
* Support importlib.metadata for finding entrypoints
* Add a basic interoperability test for Jinja2 extraction
* Only use importlib.metadata on Python 3.10+
Co-authored-by: podgorniy94 <podgorniy.inc@gmail.com>
Aarni Koskela [Thu, 25 Jul 2024 09:38:57 +0000 (12:38 +0300)]
Allow falling back to modifier-less locale data when modified data is missing (#1104)
IOW, e.g. the data loaded by `ja_JP@mod` is `ja_JP` in the absence of data that would have the modifier present.
Fixes #1089
Tomas R [Thu, 25 Jul 2024 09:34:35 +0000 (11:34 +0200)]
Improve docs for `format_skeleton` (#1106)
Makes it explicit that even when using fuzzy=True, the function can still raise if there are no suitable formats that match the skeleton.
Aarni Koskela [Tue, 23 Jul 2024 16:28:59 +0000 (19:28 +0300)]
Allow parsing .po files that have an extant but empty Language header (#1101)
Fixes #1087
Aarni Koskela [Tue, 23 Jul 2024 07:10:08 +0000 (10:10 +0300)]
Avoid crashing on importing `babel.localtime` when TZ envvar is malformed (#1100)
When `pytz` is _not_ installed, importing `babel.localtime` could fail
(repeatedly) when the `TZ` environment variable is malformed enough to be
caught by `_validate_tzfile_path`, which might throw a certain `ValueError`.
(When `pytz` is installed, it would raise an `UnknownTimeZoneError` we
already catch and ignore for the same sort of input.)
Fixes #1092
Aarni Koskela [Thu, 18 Jul 2024 09:07:02 +0000 (12:07 +0300)]
Improve Codecov configuration (#1103)
Aarni Koskela [Mon, 15 Jul 2024 12:05:41 +0000 (15:05 +0300)]
Merge pull request #1099 from python-babel/issue-1098
Support list format fallbacks
Aarni Koskela [Thu, 11 Jul 2024 11:54:16 +0000 (14:54 +0300)]
Support list format fallbacks
Aarni Koskela [Thu, 11 Jul 2024 11:06:02 +0000 (14:06 +0300)]
Do not import list patterns that have no parts
Aarni Koskela [Thu, 11 Jul 2024 10:43:22 +0000 (13:43 +0300)]
Use conventional parametrize in list tests
Bohdan Malomuzh [Thu, 11 Jul 2024 06:30:06 +0000 (09:30 +0300)]
Improve test for ignore_dirs (#1052)
Adds multiple value for proper test.
Follows up on #832
Tomas R [Thu, 11 Jul 2024 06:11:04 +0000 (08:11 +0200)]
Make pgettext search plurals when translation is not found (#1085)
pgettext can now find the following translation
when using `pgettext("ctx", "foo")`:
```
msgctxt "ctx"
msgid "foo"
msgid_plural "foos"
msgstr[0] "foo translated"
```
The upstream CPython PR is https://github.com/python/cpython/pull/107118
Tomas R [Thu, 11 Jul 2024 06:10:19 +0000 (08:10 +0200)]
Upgrade to CLDR 45 (#1077)
* Upgrade to CLDR 45
* Handle 'localeRules="nonlikelyScript"' for parent locales
Locales of the form 'lang_Script' where 'Script' is not the
likely script for 'lang' should have 'root' as their parent
locale. For example, the parent of 'az_Arab' should not be
computed as 'az' by truncating from the end, but should be
'root' instead as 'Arab' is not the likely script for 'az'.
The list of such languages was previously specified using
an explicit 'locales' attribute. It is now handled dynamically
using the new 'localeRules' attribute.
Aarni Koskela [Thu, 11 Jul 2024 05:53:43 +0000 (08:53 +0300)]
Upgrade pre-commit tools, fix ruff issues
Aarni Koskela [Thu, 11 Jul 2024 05:49:37 +0000 (08:49 +0300)]
CI: use macos-12, not macos-11 (which is gone)
Leonid [Wed, 10 Jul 2024 15:07:14 +0000 (18:07 +0300)]
Fix ignore-dirs issue (#1094) (#1095)
Tomas R [Mon, 13 May 2024 13:40:32 +0000 (15:40 +0200)]
Replace deprecated 'ast.Str' with 'ast.Constant' (#1083)
Aarni Koskela [Sun, 5 May 2024 14:13:26 +0000 (17:13 +0300)]
Upgrade GitHub Actions versions to avoid deprecation warnings (#1080)
Aarni Koskela [Sun, 5 May 2024 13:48:29 +0000 (16:48 +0300)]
Prepare for 2.15.0 release (#1079)
Aarni Koskela [Thu, 25 Apr 2024 18:23:10 +0000 (21:23 +0300)]
Encode support for the "fall back to short format" logic for time delta formatting (#1075)
Fixes #892
Aarni Koskela [Mon, 22 Apr 2024 06:54:14 +0000 (09:54 +0300)]
Include Unicode license in `locale-data` and in documentation (#1074)
Fixes #1072
Ronan Amicel [Mon, 22 Apr 2024 06:53:54 +0000 (08:53 +0200)]
Allow alternative space characters as group separator when parsing numbers (#1007)
The French group separator is `"\u202f"` (narrow non-breaking space),
but when parsing numbers in the real world, you will most often encounter
either a regular space character (`" "`) or a non-breaking space character
(`"\xa0"`).
The issue was partially adressed earlier in https://github.com/python-babel/babel/issues/637,
but only to allow regular spaces instead of non-breaking spaces `"\xa0"` in
`parse_decimal`.
This commit goes further by changing both `parse_number` and `parse_decimal`
to allow certain other space characters when the group character is itself a space character,
but is not present in the string to parse.
Unit tests are included.