This document describes the workflow in which translators can contribute to our localisation initiative. It is based on gettext, an established standard for internationalization and localization. It naively maps messages in a program to a translated string.
In the absence of Transifex, this is an interim solution until we establish a formal collaborative process using a localisation platform such Weblate. The process that we suggest here requires some basic knowldge of the command-line interface and the Archivematica development environment as well as git to submit contributions.
Messages are extracted in .po files that are tracked in our git repositories. Translators can submit updates for these documents containing the corresponding translations. Later, at deployment time, we compile the .po files (text format optimized for editing) into .mo files (binary format optimized for faster reads) that are used by the application at runtime.
Follow the installation instructions.
This is the layout of the archivematica repository:
.
├── [...]
├── hack
│ ├── [...]
│ └── submodules
│ │ ├── [...]
│ │ └── archivematica-storage-service
└── src
└── archivematica
├── archivematicaCommon
├── dashboard
├── MCPClient
├── MCPServer
├── search
└── settings
In this repository we're going to be using docker compose. It is executed under the hack directory.
Other commands are executed directly inside the git checkouts: archivematica or archivematica-storage-service.
Translators spend most of the time editing .po files. This is usually done from a localisation platform like Weblate but there are other tools that can be executed locally like Poedit:
This document shares some commands where docker compose is used to execute processes inside Archivematica containers. When we do this, it is preferably to run the processes with the form UID:GID. We do this by adding the option --user=1000:1000. Please update them according to your preferred UID and GID.
Discover your UID and GID values with the following commands:
$ id -u
1000
$ id -g
1000
Main components covered by this document:
- Archivematica » Dashboard (Django)
- Archivematica » MCPServer (workflow)
- Archivematica Storage Service (Django)
These will be covered later:
- Archivematica » Dashboard » Transfer Browser
- Archivematica » Dashboard » Appraisal Tab
Pull out strings marked for translation:
docker compose exec --user 1000:1000 archivematica-dashboard bash -c "cd /src/src/archivematica/dashboard && ./manage.py makemessages --locale no --domain django --verbosity 3"
docker compose exec --user 1000:1000 archivematica-dashboard bash -c "cd /src/src/archivematica/dashboard && ./manage.py makemessages --locale no --domain djangojs --ignore media/js/build --verbosity 3"
Confirm that the message files have been created:
$ git status -s
M ../src/archivematica/dashboard/locale/no/LC_MESSAGES/django.po
M ../src/archivematica/dashboard/locale/no/LC_MESSAGES/djangojs.po
$ ls ../src/archivematica/dashboard/locale/no/LC_MESSAGES/
djangojs.po django.po
These two .po files contain the original messages and will contain our translations. These are the files that we would be delivering to Archivematica maintainers. They can be edited with applications such Poedit. This is how entries look like in .po files:
#: fpr/templates/fpr/format/detail.html:53
#: fpr/templates/fpr/format/version/detail.html:29
#: fpr/templates/fpr/idtool/detail.html:27
#: fpr/templates/fpr/idtool/list.html:30
#: templates/administration/sidebar.html:51
#: templates/administration/version.html:5
#: templates/administration/version.html:6
#: templates/administration/version.html:23
msgid "Version"
msgstr "Versjon"These files need to be compiled as follows before they can be used by the application:
docker compose exec --user 1000:1000 archivematica-dashboard bash -c "cd /src/src/archivematica/dashboard && ./manage.py compilemessages --locale no"
Finally, make sure that no is added to the list of supported languages. This is done in src/archivematica/dashboard/settings/base.py:
LANGUAGES = [
("en", _("English")),
("fr", _("French")),
("es", _("Spanish")),
("ja", _("Japanese")),
("pt", _("Portuguese")),
("pt-br", _("Brazilian Portuguese")),
("sv", _("Swedish")),
("no", _("Norwegian")),
]Translations may not show up unless the service is restarted:
docker compose restart archivematica-dashboard
In these case, the translations are stored in the same document where the workflow definition lives: src/archivematica/MCPServer/assets/workflow.json. It is a JSON-encoded document that has to be edited carefully to avoid introducing syntax errors. Editors such Visual Studio Code can help in the editing process.
This is one of the entries found in the workflow document:
"group": {
"en": "Complete transfer",
"es": "Completar transferencia",
"fr": "Transfert complété",
"ja": "転送完了",
"no": "Fullfør overføring",
"pt_BR": "Transferência completa",
"sv": "Slutför överföring"
}MCPServer needs to be restarted for the changes to apply:
docker compose restart archivematica-mcp-server
This is how it should look like:
This process is similar to Dashboard since it's also based on the Django web framework.
docker compose exec --user 1000:1000 archivematica-storage-service bash -c "cd /src/src/archivematica/storage_service && ./manage.py makemessages --locale no --domain django --verbosity 3"
docker compose exec --user 1000:1000 archivematica-storage-service bash -c "cd /src/src/archivematica/storage_service && ./manage.py makemessages --locale no --domain djangojs --verbosity 3"
New message files are created should be generated as expected:
$ git -C submodules/archivematica-storage-service status -s
M src/archivematica/storage_service/locale/no/LC_MESSAGES/django.po
$ ls submodules/archivematica-storage-service/src/archivematica/storage_service/locale/no/LC_MESSAGES/
djangojs.po django.po
Compilation:
docker compose exec --user 1000:1000 archivematica-storage-service bash -c "cd /src/src/archivematica/storage_service && ./manage.py compilemessages --locale no"
The LANGUAGES dictionary can be found at submodules/archivematica-storage-service/src/archivematica/storage_service/storage_service/settings/base.py.
The service can be restarted with:
docker compose restart archivematica-storage-service


