Internationalize apps
Description
Apps should be internationalized. A big part of this is translations.
Our remappers provide a simple entry point to get started with this. We should encourage all block developers to make user facing texts remappers. They may use a hard coded string to provide English as a last fallback.
Some user facing texts aren’t part of a block, e.g. page titles and block titles. These texts should also be transformed into remappers. These can be targeted by specifying the path in the app definition to the content to translate.
app.yaml
primaryLanguage: en # implied/default
pages:
- name: Foo # Foo is the title for the primary language.
blocks:
- parameters:
myLabel:
- string.format:
messageId: myLabel
values:
foo: Test
messages/en.yaml
myLabel: This is my label {foo} # This is my label Test
# autogenerated/available by default
appsemble:pages.0: Translated Page Name
When uploading languages for an app, the app has an directory named messages
. The messages
directory contains YAML files named <lang-code>.yaml
. These will be uploaded to the translations
API when uploading the app.
apps/
└─ waarnemingen/
├─ app.yaml
└─ messages/
├─ en.yaml
├─ en-GB.yaml
├─ en-US.yaml
└─ nl-NL.yaml
Requirements
-
Redirect user to appropriate language path ( /en-us/page-name
) -
Option to set fallback/primary language for app -
Check if language name is valid
-
-
Add messageId
tomessage.format
(alternatively, introduce a message remapper) -
Database table to store translations ( AppId
,language
,content
) -
API endpoint for getting translations -
API endpoint for setting translations -
Page name translations -
Adjust defaultPage
to work with this
-
-
Display warnings/check usage of translation message IDs -
Set preferred language on user profile (order of preference) #417 (closed) -
Fall back to {messageId}
if no translation can be found #414 (closed) -
Show warning if no translations can be found on save-
Merge with base language ( nl
withnl-NL
andnl-BE
)
-
-
When cloning a translated app, translations should be cloned too #415 (closed)