Localization & Localized Checkout
Locale negotiation, translated messages, product content and localized checkout.
Supported locales
| Code | Language | Default currency |
|---|---|---|
en |
English | USD |
es |
Español | EUR |
fr |
Français | EUR |
bn |
বাংলা | BDT |
hi |
हिन्दी | INR |
Locale negotiation
Every request can select a locale with, in priority order:
?lang=esX-Locale: esAccept-Language: es-MX,es;q=0.9,en;q=0.8
Regional tags fall back to the base language. Unsupported locales fall back to en. Responses
carry Content-Language.
Message catalogs
Returns key → translated value for the catalog. Unknown messages fall back to English. Error
responses (message/title) are translated automatically when the error text is in the catalog.
Localized checkout
CheckoutRequest accepts locale (defaults to en):
{
"shippingAddressId": "address-uuid",
"shippingMethodId": "method-uuid",
"currency": "EUR",
"locale": "fr",
"paymentMethod": "CREDIT_CARD"
}
- The locale is stored on the order and returned as
order.locale. OrderResponse.formattedTotaluses the order currency + locale.- Checkout summary returns
localeplusformattedSubTotal,formattedShipping,formattedTax,formattedDiscountandformattedTotal. - Currency conversion still comes from FX rates; the locale only changes presentation and translated content.
Localized product content
Product detail, product lists, search results and recommendations use the request locale. Fallback is the default product row.
Admin APIs:
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/admin/products/{id}/translations |
List translations |
| PUT | /api/v1/admin/products/{id}/translations/{locale} |
Create/update |
| DELETE | /api/v1/admin/products/{id}/translations/{locale} |
Delete |
| GET | /api/v1/i18n/locales |
List supported locales |
| GET | /api/v1/i18n/messages |
Get translated API message catalog |
Only supported locale codes are accepted. Translations are only applied when the code matches the request locale; missing translations fall back to the product's default name/description.
Endpoint Details
1. List a product's translations
curl -X 'GET' \
'http://localhost:8080/api/v1/admin/products/6c5078d3-f8e3-4c88-9afe-48b5423c664f/translations' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <admin_token>'
Response
[
{
"productId": "6c5078d3-f8e3-4c88-9afe-48b5423c664f",
"locale": "en",
"name": "Example",
"description": "Looks good"
}
]
2. Create or update a product translation
curl -X 'PUT' \
'http://localhost:8080/api/v1/admin/products/6c5078d3-f8e3-4c88-9afe-48b5423c664f/translations/en' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <admin_token>' \
-H 'Content-Type: application/json' \
-d '{
"name": "Example",
"description": "Looks good"
}'
Response
{
"productId": "6c5078d3-f8e3-4c88-9afe-48b5423c664f",
"locale": "en",
"name": "Example",
"description": "Looks good"
}
3. Delete a product translation
curl -X 'DELETE' \
'http://localhost:8080/api/v1/admin/products/6c5078d3-f8e3-4c88-9afe-48b5423c664f/translations/en' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <admin_token>'