babel
babel copied to clipboard
The official repository for Babel, the Python Internationalization Library
Closes #1090 This uses `parse_pattern` internally when a custom format is used.
`str.index` raises a `ValueError` when the substring is not found so there is no way to even check the return value as the code currently tries to do. Replacing it...
For the project I'm working on - a simple Litestar-implemented API - we are using Babel to manage translation responses. For us, .pot, .po and .mo files are overkill. We...
Related discussion: #1084 Replaces some additional characters which never appear in resource files before matching the skeleton. This replicates the behaviour of ICU: https://github.com/unicode-org/icu/blob/5e22f0076ec9b55056cd8a84e9ef370632f44174/icu4j/main/core/src/main/java/com/ibm/icu/text/DateIntervalInfo.java#L1090-L1102
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...
## Overview Description When a file contains multiple obsoletes _from different contexts_, and they have the same ID, all but the last one will get stripped from the file. ##...
## Overview Consider this piece of code: ```py _( "hello", dummy_fn_call() ) ``` Extracting it yields the following result: ```py (3, 'hello', [], None) ``` As you may have noticed,...
## Overview https://github.com/python-babel/babel/pull/488 enabled the `python` extractor to look at nested calls for strings to extract, but the way it does it ignores nested gettext calls when there's more than...
The below code triggers an exception with the following message: `ValueError: invalid literal for int() with base 10: '\x0c'`. This occurs in `_process_keyword_line` at line 251 in `pofile.py` as a...
This PR updates Ruff, configures the target line-length to 95 (strikes a balance between the current line lengths in the repo and readability), and formats `babel/`. Some artful `# fmt:...