-
Notifications
You must be signed in to change notification settings - Fork 0
Languages
Languages are divided into 2 typologies:
- Backend languages (translations of the admin panel)
- Content languages (for multi-lang contents in your database)
To define backend languages, you must create them in your enviroment.ts.
export const environment = {
//...
languages: [
{
name: 'Italiano',
isoCode: 'it'
},
{
name: 'English',
isoCode: 'en'
}
],
currentLang: 'en',
//...
}
Each language must have a name and an isoCode. Please note the currentLang value, which determines the default language of the backend (it's called currentLang, because it will change based on the user's choice).
There is a src/translations.ts file where you can define translations for all your languages. Here is an example:
export const translations = {
en: {
forms: {
labels: {
submit: 'Save'
},
inputs: {
invalid_date_range: 'Invalid date range',
drag_drop: 'Drag & Drop or',
choose_files: 'choose file(s)',
max_files: 'Max files:',
uploading_files: 'Uploading, please wait'
},
errors: {
required: 'is required',
max: 'is too big. Max value:',
min: 'is too small. Min value:'
}
},
toasts: {
success: {
title: 'Success',
message: 'Operation completed successfully'
},
error: {
title: 'Error',
message: 'Something bad happened, try again'
},
warning: {
title: 'Warning',
message: ''
},
info: {
title: 'Information',
message: ''
}
},
profile: {
logout: 'Logout',
user_info: 'User information'
},
404: {
oops: 'Oops! You\'re lost.',
page_title: '404 - Page not found',
page_not_found: 'The page you are looking for was not found.',
}
}
};
To allow admins to change backend language, you must add the profile page
To define content languages, you must add them in your setup.json.
{
"contentLanguages": [
{
"id": 1,
"name": "Italiano",
"isoCode": "it",
"isDefault": false
},
{
"id": 2,
"name": "English",
"isoCode": "en",
"isDefault": true
}
],
"pages": [...]
}
Each language must have id, name, isoCode and the isDefault value to determine which is the default language.
Languages defined as content languages, are visible only if the form or the table supports multi-lang contents. To define them, please read forms configuration and tables configuration.
-
File examples