sdkagent

babel API reference

129 public APIs from babel (python-babel/babel) — 11 classes, 45 functions, 73 methods. Signatures extracted by static analysis of the actual source.

Repository: python-babel/babel

KindCount
Classes11
Functions45
Methods73

API list

classbabel.core.Locale
Representation of a specific locale.
methodbabel.core.Locale.character_order() -> str
The text direction for the language.
methodbabel.core.Locale.currency_formats() -> localedata.LocaleDataDict
Locale patterns for currency number formatting.
methodbabel.core.Locale.currency_symbols() -> localedata.LocaleDataDict
Mapping of currency codes to symbols.
methodbabel.core.Locale.date_formats() -> localedata.LocaleDataDict
Locale patterns for date formatting.
methodbabel.core.Locale.datetime_formats() -> localedata.LocaleDataDict
Locale patterns for datetime formatting.
methodbabel.core.Locale.datetime_skeletons() -> localedata.LocaleDataDict
Locale patterns for formatting parts of a datetime.
methodbabel.core.Locale.day_period_rules() -> localedata.LocaleDataDict
Day period rules for the locale.
methodbabel.core.Locale.days() -> localedata.LocaleDataDict
Locale display names for weekdays.
methodbabel.core.Locale.decimal_formats() -> localedata.LocaleDataDict
Locale patterns for decimal number formatting.
methodbabel.core.Locale.default_numbering_system() -> str
The default numbering system used by the locale.
methodbabel.core.Locale.display_name() -> str | None
The localized display name of the locale.
methodbabel.core.Locale.english_name() -> str | None
The english display name of the locale.
methodbabel.core.Locale.eras() -> localedata.LocaleDataDict
Locale display names for eras.
methodbabel.core.Locale.first_week_day() -> int
The first day of a week, with 0 being Monday.
methodbabel.core.Locale.get_display_name(locale:Locale | str | None=None) -> str | None
Return the display name of the locale using the given locale.
methodbabel.core.Locale.get_language_name(locale:Locale | str | None=None) -> str | None
Return the language of this locale in the given locale.
methodbabel.core.Locale.get_script_name(locale:Locale | str | None=None) -> str | None
Return the script name in the given locale.
methodbabel.core.Locale.get_territory_name(locale:Locale | str | None=None) -> str | None
Return the territory name in the given locale.
methodbabel.core.Locale.interval_formats() -> localedata.LocaleDataDict
Locale patterns for interval formatting.
methodbabel.core.Locale.language_name() -> str | None
The localized language name of the locale.
methodbabel.core.Locale.languages() -> localedata.LocaleDataDict
Mapping of language codes to translated language names.
methodbabel.core.Locale.list_patterns() -> localedata.LocaleDataDict
Patterns for generating lists ..
methodbabel.core.Locale.measurement_systems() -> localedata.LocaleDataDict
Localized names for various measurement systems.
methodbabel.core.Locale.meta_zones() -> localedata.LocaleDataDict
Locale display names for meta time zones.
methodbabel.core.Locale.months() -> localedata.LocaleDataDict
Locale display names for months.
methodbabel.core.Locale.number_symbols() -> localedata.LocaleDataDict
Symbols used in number formatting by number system.
methodbabel.core.Locale.ordinal_form() -> PluralRule
Plural rules for the locale.
methodbabel.core.Locale.parse(identifier:Locale | str | None, sep:str='_', resolve_likely_subtags:bool=True) -> Locale
Create a `Locale` instance for the given locale identifier.
methodbabel.core.Locale.percent_formats() -> localedata.LocaleDataDict
Locale patterns for percent number formatting.
methodbabel.core.Locale.periods() -> localedata.LocaleDataDict
Locale display names for day periods (AM/PM).
methodbabel.core.Locale.plural_form() -> PluralRule
Plural rules for the locale.
methodbabel.core.Locale.quarters() -> localedata.LocaleDataDict
Locale display names for quarters.
methodbabel.core.Locale.scientific_formats() -> localedata.LocaleDataDict
Locale patterns for scientific number formatting.
methodbabel.core.Locale.script_name() -> str | None
The localized script name of the locale if available.
methodbabel.core.Locale.scripts() -> localedata.LocaleDataDict
Mapping of script codes to translated script names.
methodbabel.core.Locale.territories() -> localedata.LocaleDataDict
Mapping of script codes to translated script names.
methodbabel.core.Locale.territory_name() -> str | None
The localized territory name of the locale if available.
methodbabel.core.Locale.text_direction() -> str
The text direction for the language in CSS short-hand form.
methodbabel.core.Locale.time_formats() -> localedata.LocaleDataDict
Locale patterns for time formatting.
methodbabel.core.Locale.time_zones() -> localedata.LocaleDataDict
Locale display names for time zones.
methodbabel.core.Locale.unit_display_names() -> localedata.LocaleDataDict
Display names for units of measurement.
methodbabel.core.Locale.variants() -> localedata.LocaleDataDict
Mapping of script codes to translated script names.
methodbabel.core.Locale.weekend_end() -> int
The day the weekend ends, with 0 being Monday.
methodbabel.core.Locale.weekend_start() -> int
The day the weekend starts, with 0 being Monday.
methodbabel.core.Locale.zone_formats() -> localedata.LocaleDataDict
Patterns related to the formatting of time zones.
funcbabel.core.get_global(key:_GLOBAL_KEY) -> Mapping[str, Any]
Return the dictionary for the given key in the global data.
methodbabel.dates.DateTimeFormat.format_frac_seconds(num:int) -> str
Return fractional seconds.
methodbabel.dates.DateTimeFormat.format_period(char:str, num:int) -> str
Return period from parsed datetime according to format pattern.
methodbabel.dates.DateTimeFormat.format_weekday(char:str='E', num:int=4) -> str
Return weekday from parsed datetime according to format pattern.
methodbabel.dates.DateTimeFormat.get_week_number(day_of_period:int, day_of_week:int | None=None) -> int
Return the number of the week of a day within a period.
methodbabel.dates.DateTimeFormat.get_week_of_month() -> int
Return the week of the month.
methodbabel.dates.DateTimeFormat.get_week_of_year() -> int
Return the week of the year.
funcbabel.dates.format_date(date:datetime.date | None=None, format:_PredefinedTimeFormat | str='medium', locale:Locale | str | None=None) -> str
Return a date formatted according to the given pattern.
funcbabel.dates.get_period_id(time:_Instant, tzinfo:datetime.tzinfo | None=None, type:Literal['selection'] | None=None, locale:Locale | str | None=None) -> str
Get the day period ID for a given time.
funcbabel.dates.get_timezone(zone:str | datetime.tzinfo | None=None) -> datetime.tzinfo
Looks up a timezone by name and returns it.
funcbabel.dates.parse_date(string:str, locale:Locale | str | None=None, format:_PredefinedTimeFormat | str='medium') -> datetime.date
Parse a date from a string.
funcbabel.dates.parse_pattern(pattern:str | DateTimePattern) -> DateTimePattern
Parse date, time, and datetime format patterns.
funcbabel.dates.parse_time(string:str, locale:Locale | str | None=None, format:_PredefinedTimeFormat | str='medium') -> datetime.time
Parse a time from a string.
funcbabel.dates.split_interval_pattern(pattern:str) -> list[str]
Split an interval-describing datetime pattern into multiple pieces.
funcbabel.dates.tokenize_pattern(pattern:str) -> list[tuple[str, str | tuple[str, int]]]
Tokenize date format patterns.
funcbabel.dates.untokenize_pattern(tokens:Iterable[tuple[str, str | tuple[str, int]]]) -> str
Turn a date format pattern token stream back into a string.
funcbabel.languages.get_official_languages(territory:str, regional:bool=False, de_facto:bool=False) -> tuple[str, ...]
Get the official language(s) for the given territory.
funcbabel.lists.format_list(lst:Sequence[str], style:Literal['standard', 'standard-short', 'or', 'or-short', 'unit', 'unit-short', 'unit-narrow']='standard', locale:Locale | str | None=None) -> str
Format the items in `lst` as a list.
classbabel.localedata.Alias
Representation of an alias in the locale data.
methodbabel.localedata.Alias.resolve(data:Mapping[str | int | None, Any]) -> Mapping[str | int | None, Any]
Resolve the alias based on the given data.
funcbabel.localedata.clear_caches() -> None
Clear locale data caches.
funcbabel.localedata.exists(name:str) -> bool
Check whether locale data is available for the given locale.
funcbabel.localedata.load(name:os.PathLike[str] | str, merge_inherited:bool=True) -> dict[str, Any]
Load the locale data for the given locale.
funcbabel.localedata.normalize_locale(name:str) -> str | None
Normalize a locale ID by stripping spaces and apply proper casing.
funcbabel.localedata.resolve_locale_filename(name:os.PathLike[str] | str) -> str
Resolve a locale identifier to a `.dat` path on disk.
funcbabel.localtime._win32.valuestodict(key) -> dict[str, Any]
Convert a registry key's values to a dictionary.
funcbabel.localtime.get_localzone() -> datetime.tzinfo
Returns the current underlying local timezone object.
classbabel.messages.catalog.Catalog
Representation of a message catalog.
methodbabel.messages.catalog.Catalog.delete(id:_MessageID, context:str | None=None) -> None
Delete the message with the specified ID and context.
methodbabel.messages.catalog.Catalog.get(id:_MessageID, context:str | None=None) -> Message | None
Return the message with the specified ID and context.
methodbabel.messages.catalog.Catalog.header_comment() -> str
The header comment for the catalog.
methodbabel.messages.catalog.Catalog.num_plurals() -> int
The number of plurals used by the catalog or locale.
methodbabel.messages.catalog.Catalog.plural_expr() -> str
The plural expression used by the catalog or locale.
methodbabel.messages.catalog.Catalog.plural_forms() -> str
Return the plural forms declaration for the locale.
classbabel.messages.catalog.Message
Representation of a single message in a catalog.
methodbabel.messages.catalog.Message.check(catalog:Catalog | None=None) -> list[TranslationError]
Run various validation checks on the message.
methodbabel.messages.catalog.Message.fuzzy() -> bool
Whether the translation is fuzzy.
methodbabel.messages.catalog.Message.pluralizable() -> bool
Whether the message is plurizable.
methodbabel.messages.catalog.Message.python_format() -> bool
Whether the message contains Python-style parameters.
funcbabel.messages.checkers.num_plurals(catalog:Catalog | None, message:Message) -> None
Verify the number of plurals in the translation.
funcbabel.messages.checkers.python_format(catalog:Catalog | None, message:Message) -> None
Verify the format string placeholders in the translation.
classbabel.messages.frontend.CommandLineInterface
Command-line interface.
classbabel.messages.frontend.ConfigurationError
Raised for errors in configuration files.
funcbabel.messages.frontend.listify_value(arg, split=None)
Make a list out of an argument.
funcbabel.messages.jslexer.tokenize(source:str, jsx:bool=True, dotted:bool=True, template_string:bool=True, lineno:int=1) -> Generator[Token, None, None]
Tokenize JavaScript/JSX source.
funcbabel.messages.jslexer.unquote_string(string:str) -> str
Unquote a string with JavaScript rules.
funcbabel.messages.pofile.denormalize(string:str) -> str
Reverse the normalization done by the `normalize` function.
funcbabel.messages.pofile.normalize(string:str, prefix:str='', width:int=76) -> str
Convert a string into a format that is appropriate for .po files.
funcbabel.messages.pofile.unescape(string:str) -> str
Reverse `escape` the given string.
classbabel.numbers.NumberFormatError
Exception raised when a string cannot be parsed into a number.
funcbabel.numbers.format_number(number:float | decimal.Decimal | str, locale:Locale | str | None=None) -> str
Return the given number formatted for a specific locale.
funcbabel.numbers.get_currency_precision(currency:str) -> int
Return currency's precision.
funcbabel.numbers.get_decimal_precision(number:decimal.Decimal) -> int
Return maximum precision of a decimal instance's fractional part.
funcbabel.numbers.get_decimal_quantum(precision:int | decimal.Decimal) -> decimal.Decimal
Return minimal quantum of a number, as defined by precision.
funcbabel.numbers.is_currency(currency:str, locale:Locale | str | None=None) -> bool
Returns `True` only if a currency is recognized by Babel.
funcbabel.numbers.list_currencies(locale:Locale | str | None=None) -> set[str]
Return a `set` of normalized currency codes.
funcbabel.numbers.normalize_currency(currency:str, locale:Locale | str | None=None) -> str | None
Returns the normalized identifier of any currency code.
funcbabel.numbers.parse_number(string:str, locale:Locale | str | None=None, *numbering_system:Literal['default'] | str='latn') -> int
Parse localized number string into an integer.
funcbabel.numbers.parse_pattern(pattern:NumberPattern | str) -> NumberPattern
Parse number format patterns
funcbabel.numbers.parse_precision(p)
Calculate the min and max allowed digits
funcbabel.numbers.validate_currency(currency:str, locale:Locale | str | None=None) -> None
Check the currency code is recognized by Babel.
classbabel.plural.PluralRule
Represents a set of language pluralization rules.
methodbabel.plural.PluralRule.parse(rules:Mapping[str, str] | Iterable[tuple[str, str]] | PluralRule) -> PluralRule
Create a `PluralRule` instance for the given rules.
methodbabel.plural.PluralRule.rules() -> Mapping[str, str]
The `PluralRule` as a dict of unicode plural rules.
methodbabel.plural.PluralRule.tags() -> frozenset[str]
A set of explicitly defined tags in this rule.
classbabel.plural.RuleError
Raised if a rule is malformed.
funcbabel.plural.cldr_modulo(a:float, b:float) -> float
Javaish modulo.
funcbabel.plural.in_range_list(num:float | decimal.Decimal, range_list:Iterable[Iterable[float | decimal.Decimal]]) -> bool
Integer range list test.
funcbabel.plural.to_gettext(rule:Mapping[str, str] | Iterable[tuple[str, str]] | PluralRule) -> str
The plural rule as gettext expression.
funcbabel.plural.within_range_list(num:float | decimal.Decimal, range_list:Iterable[Iterable[float | decimal.Decimal]]) -> bool
Float range test.
methodbabel.support.Format.currency(number:float | Decimal | str, currency:str) -> str
Return a number in the given currency formatted for the locale.
methodbabel.support.Format.date(date:_datetime.date | None=None, format:_PredefinedTimeFormat | str='medium') -> str
Return a date formatted according to the given pattern.
methodbabel.support.Format.decimal(number:float | Decimal | str, format:str | None=None) -> str
Return a decimal number formatted for the locale.
methodbabel.support.Format.number(number:float | Decimal | str) -> str
Return an integer number formatted for the locale.
methodbabel.support.Format.percent(number:float | Decimal | str, format:str | None=None) -> str
Return a number formatted as percentage for the locale.
methodbabel.support.Format.scientific(number:float | Decimal | str) -> str
Return a number formatted using scientific notation for the locale.
classbabel.support.Translations
An extended translation catalog class.
methodbabel.support.Translations.add(translations:Translations, merge:bool=True)
Add the given translations to the catalog.
methodbabel.support.Translations.merge(translations:Translations)
Merge the given translations into the catalog.
classbabel.util.FixedOffsetTimezone
Fixed offset in minutes east from UTC.
funcbabel.util.distinct(iterable:Iterable[_T]) -> Generator[_T, None, None]
Yield all items in an iterable collection that are distinct.
funcbabel.util.parse_encoding(fp:IO[bytes]) -> str | None
Deduce the encoding of a source file from magic comment.
funcbabel.util.pathmatch(pattern:str, filename:str) -> bool
Extended pathname pattern matching.

About this data

These signatures were extracted from the public source of python-babel/babel using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries