
Security News
High-Severity RCE Vulnerability Disclosed in next-mdx-remote
HashiCorp disclosed a high-severity RCE in next-mdx-remote affecting versions 4.3.0 to 5.x when compiling untrusted MDX on the server.
fastapi-localization
Advanced tools
fastapi_localization - provides a simple language localization from Accept-Language header in your application.
Installation
$ pip install fastapi-localization
Example with small fastapi application
from typing import List
from pydantic import BaseModel
from fastapi_localization import TranslateJsonResponse
from fastapi_localization import TranslatableStringField
class LanguageTranslatableSchema(BaseModel):
code: str
title: TranslatableStringField
@app.get(
'/language',
response_class=TranslateJsonResponse,
response_model=List[LanguageTranslatableSchema])
async def languages():
return [{'code': 'ru', 'title': 'Russia'},
{'code': 'en', 'title': 'English'}]
# Russia
$ curl --location --request GET 'http://127.0.0.1:8000/language' \
--header 'Accept-Language: ru'
[{"code":"ru","title":"Русский"},{"code":"en","title":"Английский"}]
# English
$ curl --location --request GET 'http://127.0.0.1:8000/language' \
--header 'Accept-Language: en'
[{"code":"ru","title":"Russia"},{"code":"en","title":"English"}]
manual partial translation
from fastapi_localization import TranslateJsonResponse
from fastapi_localization import lazy_gettext as _
@app.get(
'/country',
response_class=TranslateJsonResponse)
async def countries():
return [{'code': 'ru', 'title': _('Russia')},
{'code': 'us', 'title': 'USA'}]
# Russian
$ curl --location --request GET 'http://127.0.0.1:8000/country' \
--header 'Accept-Language: ru'
[{"code":"ru","title":"Русский"},{"code":"us","title":"USA"}]
# English
$ curl --location --request GET 'http://127.0.0.1:8000/country' \
--header 'Accept-Language: en'
[{"code":"ru","title":"Russia"},{"code":"us","title":"USA"}]
error validation
from pydantic import BaseModel, EmailStr
from fastapi_localization import TranslateJsonResponse
class InputSchema(BaseModel):
email = EmailStr()
@app.post(
'/input',
response_class=TranslateJsonResponse)
async def countries(value: InputSchema):
return value
# Russia
$ curl --location --request POST 'http://127.0.0.1:8000/input' \
--header 'Accept-Language: ru' \
--header 'Content-Type: application/json' \
--data-raw '{"email": "invalid_email"}'
{
"detail": [
{
"loc": [
"body",
"email"
],
"msg": "значение не является действительным адресом электронной почты",
"type": "value_error.email"
}
]
}
# English
$ curl --location --request POST 'http://127.0.0.1:8000/input' \
--header 'Accept-Language: en' \
--header 'Content-Type: application/json' \
--data-raw '{"email": "invalid_email"}'
{
"detail": [
{
"loc": [
"body",
"email"
],
"msg": "value is not a valid email address",
"type": "value_error.email"
}
]
}
Application source code
FAQs
Language localization fastapi
We found that fastapi-localization demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
HashiCorp disclosed a high-severity RCE in next-mdx-remote affecting versions 4.3.0 to 5.x when compiling untrusted MDX on the server.

Security News
Security researchers report widespread abuse of OpenClaw skills to deliver info-stealing malware, exposing a new supply chain risk as agent ecosystems scale.

Security News
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.