It's a collection of translations for pydantic errors in any languages
Project description
Pydantic Errors Messages Translations
It's a collection of translations for pydantic errors in any languages;
Installation
Use the package manager pip to install foobar.
pip install pydantic-errors-messages-translations pydantic-i18n
Usage
from pydantic_errors_messages_translations import translations, convert_error_to_human_readable
YOUR_LANGUAGE = 'pt_BR'
error_translation = PydanticI18n(translations, default_locale=YOUR_LANGUAGE)
class User(BaseModel):
name: str = Field(min_length=40)
email: str = Field(min_length=24)
city: str
try:
wrong_user = User(
name='Irineu Evangelista de Sousa',
city= 'Maua'
)
except ValidationError as e:
errors_as_dict = error_translation.translate(e.errors(), YOUR_LANGUAGE)
raise Exception(convert_error_to_human_readable(errors_as_dict))
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for pydantic_errors_messages_translations-1.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14473cf0f2942c41756fe56f399675617f7e090ef9bb900a144276c04999faeb |
|
MD5 | ca0c7e0cd0209f5a2b0d297d63b654f8 |
|
BLAKE2b-256 | ce5da3c42254e7b69be665dafc07d45caf4ed4f25d56d3e64df4fe4eb17e07d5 |
Close
Hashes for pydantic_errors_messages_translations-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5275949bad1c729b00553b1b836c2cb9d617421bb0392f89f8f2e8bb762dd153 |
|
MD5 | 6ba78043a6f00d7cc9d4e85d7ddae9f2 |
|
BLAKE2b-256 | 25c38c8b1cd4eee3e8af40ad313e7df7591cd1fa46a167ff7d9e8852f218f5bc |