Translations
Setup
Exposing translations via the REST API requires the ride/wra-i18n
module.
// composer.json
{
// ...
"ride/wra-i18n" : "*"
}
Translations are save in the custom
translations folder. Eg. application/l10n/custom/en.json
.
Locale API
/api/v1/locales
Get a collection of all locales.
/api/v1/locales/{id}
Get a specific locale.
Translations API
/api/v1/translations
Get a list of all translations.
/api/v1/translations
Create translations.
{
"data": [
{
"type": "translations",
"attributes": {
"key": "api.test",
"value": "API test"
},
"relationships": {
"locale": {
"data": {
"type": "locales",
"id": "en"
}
}
}
},
{
"type": "translations",
"attributes": {
"key": "api.test",
"value": "API test NL"
},
"relationships": {
"locale": {
"data": {
"type": "locales",
"id": "nl"
}
}
}
}
]
}
/api/v1/translations
Edit translations.
{
"data": [
{
"type": "translations",
"id": "en-api.test",
"attributes": {
"value": "API test EN"
}
},
{
"type": "translations",
"id": "nl-api.test",
"attributes": {
"value": "API test lorem ipsum"
}
}
]
}
/api/v1/translations
Delete translations.
/api/v1/translations/{id}
Get a translation by id.
GET /api/v1/translations/en-api.test
/api/v1/translations/{id}
Edit a translation.
PATCH /api/v1/translations/en-api.test
{
"data": {
"type": "translations",
"id": "en-api.test",
"attributes": {
"value": "API test EN"
}
}
}
/api/v1/translations/{id}
Delete a translation.
DELETE /api/v1/translations/en-api.test
/api/v1/translations/{id}/{relationship}
Get the relationship of a translation.
GET /api/v1/translations/nl-api.test/locale
/api/v1/translations/{id}/relationship/{relationship}
Get meta data of a translation's relationship.
GET /api/v1/translations/nl-api.test/relationship/locale
Updated less than a minute ago