API Reference
    
              SL10n
SL10n(
    locale_container: Type[T],
    path: Path | PathLike = default_path,
    *,
    default_lang: str = "en",
    ignore_filenames: Iterable[str] = (),
    parsing_impl: ParsingImpl = default_pimpl,
    strict: bool = False,
    warn_unfilled_keys: bool = False
)
            Bases: Generic[T]
Static text localization system.
To use it, first create a locale container (it MUST be a subclass of SLocale)
and define some string keys in it:
After that, create an SL10n object and pass in your locale container:
Note that it only creates a reference to your localization system. To load all locale files
and pack their content into locale containers, call SL10n.init() method:
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
locale_container | 
          
                Type[T]
           | 
          
             Locale container to use. It must be a SLocale subclass.  | 
          required | 
path | 
          
                str | PathLike | Path
           | 
          
             Path to your translation files directory. Defaults to   | 
          
                default_path
           | 
        
default_lang | 
          
                str
           | 
          
             Default language. Defaults to   | 
          
                'en'
           | 
        
ignore_filenames | 
          
                Iterable[str]
           | 
          
             What filenames the parser should ignore. Defaults to   | 
          
                ()
           | 
        
parsing_impl | 
          
                ParsingImpl
           | 
          
             What parsing implementation to use. Defaults to   | 
          
                default_pimpl
           | 
        
Raises:
| Type | Description | 
|---|---|
                TypeError
           | 
          
             When locale_container is not an   | 
        
    
              create_lang_file
  Creates a sample lang file in a requested path.
If you want to override existing file - set override to True.
Useful for fast lang file creation.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
lang | 
          
                str
           | 
          
             Language of translations in this file (used as filename).  | 
          required | 
override | 
          
                bool
           | 
          
             If   | 
          
                False
           | 
        
Warns:
| Type | Description | 
|---|---|
                SL10nAlreadyInitialized
           | 
          
             If   | 
        
                LangFileAlreadyExists
           | 
          
             When the file already exists and   | 
        
Warning
Can be called only before SL10n initialization.
    
              init
  Load all locale files and pack their content into locale containers.
You must call it to access your localization.
Example
It also returns a reference to your SL10n object, so you can use this oneline to init immediately:
Warns:
| Type | Description | 
|---|---|
                SL10nAlreadyInitialized
           | 
          
             When   | 
        
    
              locale
  Returns a locale container, containing all defined string keys translated to the requested language (if such translation exists, otherwise returns a default one).
Example
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
lang | 
          
                str
           | 
          
             Language you want to get.  | 
          
                None
           | 
        
Raises:
| Type | Description | 
|---|---|
                SL10nIsNotInitialized
           | 
          
             When   | 
        
    
              SLocale
  
  
      dataclass
  
  This class contains some specific fields and methods to your locale containers.
Also, you must subclass your locale container from this class to use it in SL10n.
    
              lang_code
  
  
      instance-attribute
  
  Current locale lang code (filename). Can be overwritten only by "$lang_code" modifier.
Sets to None if the container is a sample one.
    
              get
  Returns a string associated with the given key (if such a key exists, otherwise returns the key itself).
Can be used if the key is known only at runtime.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
key | 
          
                str
           | 
          
             Key used to get string.  | 
          required | 
Returns:
| Type | Description | 
|---|---|
                str
           | 
          
             If such a key exists, string associated with the given key.  | 
        
                str
           | 
          
             Otherwise, the key itself.  | 
        
Warns:
| Type | Description | 
|---|---|
                UnexpectedLocaleKey
           | 
          
             When got an unexpected key.  | 
        
    
              sample
  
  
      classmethod
  
  
    
              to_dict
  
    
              warnings
  
    
              DefaultLangFileNotFound
  
            Bases: UserWarning
Propogates when the default language file not found.
    
              LangFileAlreadyExists
  
            Bases: UserWarning
Propogates when the language file already exists.
    
              SL10nAlreadyInitialized
  
            Bases: UserWarning
Propogates when SL10n already initialized.
    
              UndefinedLocale
  
            Bases: UserWarning
Propogates when got an undefined locale.
    
              UndefinedLocaleKey
  
            Bases: UserWarning
Propogates when found an undefined locale key.
    
              UnexpectedLocaleKey
  
            Bases: UserWarning
Propogates when found an unexpected locale key.
    
              UnfilledLocaleKey
  
            Bases: UserWarning
Propogates when found an unfilled (value == key or value is empty) locale key.
    
              UnknownModifier
  
            Bases: UserWarning
Propogates when found an unknown modifier.
    
              pimpl
  
    
              ParsingImpl
  
            Bases: ABC
Interface for file parsing implementations.
You can inherit from it and define your own parsing implementation for SL10n.
    
              file_ext
  
  
      abstractmethod
      property
  
  
    
              load
  
  
      abstractmethod
  
  
    
              JSONImpl
  
            Bases: ParsingImpl
Interface for basic JSON parsers implementations (which follow Python's built-in json module interface).
Modules confirmed as supported: json, simplejson, ujson, rapidjson
    
              ORJSONImpl
  
            Bases: JSONImpl
Deprecated since 0.3.0.0.
Use sl10n.pimpl.JSONImpl() with one of the supported modules instead (e.g., Python's built-in json).
Interface for orjson module.
Please ensure that you have this module installed.