langstring.flags

The flags module provides enumerations for various control flags used to configure the behavior of the LangString, SetLangString, and MultiLangString classes.

This module defines several enumerations (Enums), each specifying different flags that can be set to influence the operation and validation rules of the respective classes. These flags offer a flexible way to enforce constraints and manage the behavior of multilingual text handling within the application.

Enums defined in this module:

  • GlobalFlag: Flags that affect the behavior of all classes. These global flags ensure consistent behavior across the entire system when dealing with multilingual strings.

  • LangStringFlag: Flags specific to the LangString class. These flags control how individual language strings are handled, validated, and displayed.

  • SetLangStringFlag: Flags specific to the SetLangString class. These flags manage the behavior of sets of language strings, allowing for batch operations and validations.

  • MultiLangStringFlag: Flags specific to the MultiLangString class. These flags configure the behavior of multilingual string collections, enabling complex multilingual text management.

Each enumeration includes flags for various aspects such as text validation, language code handling, and output formatting. These flags can be used to enforce rules like ensuring non-empty strings, validating language codes, converting language codes to lowercase, and controlling the inclusion of quotes and language tags in output.

Using these flags, developers can customize and control the behavior of multilingual text handling classes, ensuring that they meet the specific needs of their applications.

Classes

GlobalFlag

Enumeration for global control flags.

LangStringFlag

Enumeration for LangString control flags.

SetLangStringFlag

Enumeration for SetLangString control flags.

MultiLangStringFlag

Enumeration for MultiLangString control flags.

Module Contents

class langstring.flags.GlobalFlag(*args, **kwds)

Bases: enum.Enum

Enumeration for global control flags.

This enum defines various flags that can be used to configure the behavior of all classes in the multilingual text handling system. These flags provide a flexible way to enforce constraints and manage behavior consistently across different classes.

Variables:
  • DEFINED_LANG (Enum) – Ensures that a non-empty string is used for the ‘lang’ field of all classes.

  • DEFINED_TEXT (Enum) – Ensures that a non-empty string is used for the ‘text’ field of all classes.

  • ENFORCE_EXTRA_DEPEND (Enum) – Enforces additional dependencies required by all classes.

  • LOWERCASE_LANG (Enum) – Converts all language codes to lowercase.

  • METHODS_MATCH_TYPES (Enum) – Ensures that methods match the expected types for arguments and return values.

  • PRINT_WITH_LANG (Enum) – Includes language tags when printing multilingual text.

  • PRINT_WITH_QUOTES (Enum) – Wraps text entries in quotes when printing multilingual text.

  • STRIP_LANG (Enum) – Removes leading and trailing whitespace from language codes.

  • STRIP_TEXT (Enum) – Removes leading and trailing whitespace from text entries.

  • VALID_LANG (Enum) – Ensures that a valid language code string is used for the ‘lang’ field of all classes.

DEFINED_LANG
DEFINED_TEXT
ENFORCE_EXTRA_DEPEND
LOWERCASE_LANG
METHODS_MATCH_TYPES
PRINT_WITH_LANG
PRINT_WITH_QUOTES
STRIP_LANG
STRIP_TEXT
VALID_LANG
class langstring.flags.LangStringFlag(*args, **kwds)

Bases: enum.Enum

Enumeration for LangString control flags.

This enum defines various flags that can be used to configure the behavior of the LangString class. These flags provide a flexible way to enforce constraints and manage the behavior of multilingual text handling within the LangString class.

Variables:
  • DEFINED_LANG (Enum) – Ensures that a non-empty string is used for the ‘lang’ field of a LangString.

  • DEFINED_TEXT (Enum) – Ensures that a non-empty string is used for the ‘text’ field of a LangString.

  • LOWERCASE_LANG (Enum) – Converts all language codes to lowercase within a LangString.

  • METHODS_MATCH_TYPES (Enum) – Ensures that methods match the expected types for arguments and return values within a LangString.

  • PRINT_WITH_LANG (Enum) – Includes language tags when printing a LangString.

  • PRINT_WITH_QUOTES (Enum) – Wraps text entries in quotes when printing a LangString.

  • STRIP_LANG (Enum) – Removes leading and trailing whitespace from language codes within a LangString.

  • STRIP_TEXT (Enum) – Removes leading and trailing whitespace from text entries within a LangString.

  • VALID_LANG (Enum) – Ensures that a valid language code string is used for the ‘lang’ field of a LangString.

DEFINED_LANG
DEFINED_TEXT
LOWERCASE_LANG
METHODS_MATCH_TYPES
PRINT_WITH_LANG
PRINT_WITH_QUOTES
STRIP_LANG
STRIP_TEXT
VALID_LANG
class langstring.flags.SetLangStringFlag(*args, **kwds)

Bases: enum.Enum

Enumeration for SetLangString control flags.

This enum defines various flags that can be used to configure the behavior of the SetLangString class. These flags provide a flexible way to enforce constraints and manage the behavior of multilingual text handling within the SetLangString class.

Variables:
  • DEFINED_LANG (Enum) – Ensures that a non-empty string is used for the ‘lang’ field of a SetLangString.

  • DEFINED_TEXT (Enum) – Ensures that a non-empty string is used for the ‘text’ field of a SetLangString.

  • LOWERCASE_LANG (Enum) – Converts all language codes to lowercase within a SetLangString.

  • METHODS_MATCH_TYPES (Enum) – Ensures that methods match the expected types for arguments and return values within a SetLangString.

  • PRINT_WITH_LANG (Enum) – Includes language tags when printing a SetLangString.

  • PRINT_WITH_QUOTES (Enum) – Wraps text entries in quotes when printing a SetLangString.

  • STRIP_LANG (Enum) – Removes leading and trailing whitespace from language codes within a SetLangString.

  • STRIP_TEXT (Enum) – Removes leading and trailing whitespace from text entries within a SetLangString.

  • VALID_LANG (Enum) – Ensures that a valid language code string is used for the ‘lang’ field of a SetLangString.

DEFINED_LANG
DEFINED_TEXT
LOWERCASE_LANG
METHODS_MATCH_TYPES
PRINT_WITH_LANG
PRINT_WITH_QUOTES
STRIP_LANG
STRIP_TEXT
VALID_LANG
class langstring.flags.MultiLangStringFlag(*args, **kwds)

Bases: enum.Enum

Enumeration for MultiLangString control flags.

This enum defines various flags that can be used to configure the behavior of the MultiLangString class. These flags provide a flexible way to enforce constraints and manage the behavior of multilingual text handling within the MultiLangString class.

Variables:
  • DEFINED_LANG (Enum) – Ensures that a non-empty string is used for the ‘lang’ field of a MultiLangString.

  • DEFINED_TEXT (Enum) – Ensures that a non-empty string is used for the ‘text’ field of a MultiLangString.

  • LOWERCASE_LANG (Enum) – Converts all language codes to lowercase within a MultiLangString.

  • PRINT_WITH_LANG (Enum) – Includes language tags when printing a MultiLangString.

  • PRINT_WITH_QUOTES (Enum) – Wraps text entries in quotes when printing a MultiLangString.

  • STRIP_LANG (Enum) – Removes leading and trailing whitespace from language codes within a MultiLangString.

  • STRIP_TEXT (Enum) – Removes leading and trailing whitespace from text entries within a MultiLangString.

  • VALID_LANG (Enum) – Ensures that a valid language code string is used for the ‘lang’ field of a MultiLangString.

DEFINED_LANG
DEFINED_TEXT
LOWERCASE_LANG
PRINT_WITH_LANG
PRINT_WITH_QUOTES
STRIP_LANG
STRIP_TEXT
VALID_LANG