Awes.io Module for Editing Translations
This module is an interface, that helps you to edit translations in your database.
Basic usage
- Make shure, you are using
@awes-io/ui
and @nuxtjs/axios
- Install the module
yarn add @awes-io/nuxt-localization
- The frontend part is ready!
Backend endpoint
By default, the module will make next requests to you backend
Fetch translations to edit
{
"data": [
{
"id": 1,
"name": "ui.hello",
"value": {
"en": "Hello",
"de": "Hallo"
}
},
{
"id": 1,
"name": "another.translation.key",
"value": {
"en": "Another translation key"
}
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 42
}
}
Add new translation
{
"name": "ui.hello",
"value": {
"en": "Hello",
"de": "Hallo"
}
}
{
"errors": {
"name": "Key already exists",
"value.en": "Default translation is required"
}
}
Save edited translation
{
"id": 1,
"name": "ui.hello",
"value": {
"en": "Hello",
"de": "Hallo",
"ru": "Привет"
}
}
Delete translation
Configuration
{
awesIo: {
nuxtLocalization: {
route: '/localization',
endpoint: '/api/translations/edit',
export: '',
textLimit: 128,
data: {
default: {},
response: 'data'
},
errors: {
default: {},
response: 'errors'
},
pagination: {
page: {
default: 1,
request: 'page',
response: 'meta.current_page'
},
limit: {
default: 15,
request: 'limit',
response: 'meta.per_page'
},
total: {
response: 'meta.total'
}
},
search: { request: 'search' }
}
}
}
Ensure to write proper commit message according to Git Commit convention