Defines translations for captions, headers, and any other messages.
language
Type: string
Required: Yes
Description: ISO code of the translation language.
schema_id
Type: reference( public.schemas )
Required: Yes
Description: Reference to the schema for the funapp.translations
record
message
Type: string
Required: Yes
Description: String to be translated.
translation
Type: string
Required: Yes
Description: Translation of the string into the language specified in language
.
Translation of a string is defined in the funapp.translations
table in the format:
language |
schema_id |
message |
translation |
---|---|---|---|
en |
admin |
User View |
User View |
ru |
admin |
User View |
Пользовательское представление |
es |
admin |
User View |
Vista de Usuario |
Now, referring to the translation of the string User View
can be done in any part of a query like this:
{
schema: 'admin',
message: 'User View'
}
The example below demonstrates the use of translations in arguments, titles, field captions, buttons, and nested views:
{
$id reference(public.user_views) @{
// Translation of argument caption
caption = {
schema: 'admin',
message: 'User View'
}
}
}:
SELECT
@type = 'form',
// Translation of view title
@title = { schema: 'admin', message: 'User View' },
@buttons = [{
// Translation of button label
caption: { schema: 'admin', message: 'Documentation' },
href: 'https://wiki.ozma.io/'
}],
name @{
// Translation of field name
caption = { schema: 'admin', message: 'Name' }
},
query @{
caption = { schema: 'admin', message: 'Query' }
}
FROM public.user_views
WHERE id = $id
In default attributes and everywhere else where strings are used:
/* Default attribute - public.field_attributes */
@{
caption = {
schema: 'admin',
message: 'User View'
}
}
In the user interface, the translation will be displayed based on the language selected by the user in the menu. Language switching is performed in the burger menu in the upper left corner of the ozma.io
interface, and the selected language is automatically saved in the user settings table.
If a translation for the selected language is not specified for a particular string, the content of the message
will be displayed.
In certain cases, it might not be possible to use the translation functionality from the funapp.translations
table. In such situations, you can resort to the old method of defining translations, which is still supported in the product.
{
en: 'User View',
es: 'Vista de Usuario',
ru: 'Пользовательское представление'
}