-
Notifications
You must be signed in to change notification settings - Fork 22
Localization
The translatable UI strings use the stock dspace-angular i18n system, so
there is nothing CLARIN-specific to document — follow the upstream guides:
- Multilingual Support (DSDOC7x) — how to enable/configure supported languages in a deployment.
- DSpace 7 Translation – i18n / l10n — how the translation files work and how to contribute translations.
Orientation (see upstream for the details):
- UI translations live in
src/assets/i18n/*.json5in the Angular frontend. - Enabled languages are set in the
languagessection ofconfig/config.*.yml. -
yarn run sync-i18nsyncs a locale file against the authoritative English file.
Long-form static content is not in the i18n message files. CLARIN-DSpace
adds a static-files/ mechanism (StaticPageComponent /
HtmlContentService): HTML files in
src/static-files/
are served at <UI_URL>/static/<file>.html. This is where the deposit license,
the per-licence texts (license-*.html, licence-*.html), about.html,
faq.html, deposit.html, cookies.html, etc. live.
To localise a static page, place a translated copy under a locale subdirectory
src/static-files/<locale>/<file>.html — e.g. src/static-files/cs/faq.html.
The resolver (HtmlContentService.getHmtlContentByPathAndLocale) works like this:
- For a non-
enlocale it first triesstatic-files/<locale>/<file>.html. - If that is missing it falls back to the default
static-files/<file>.html. -
enalways uses the default (noen/subdir).
So you only need to translate the files you actually want localised; everything
else transparently falls back to the default (English) version. See the existing
src/static-files/cs/
directory for the set of pages currently translated to Czech.
Note: the deposit/distribution license shown on a collection's contract page comes from the collection's
Licenseobject via the REST API, not fromstatic-files/— that text is localised/edited as collection data, not here.
If we diverge from stock anywhere else, document that delta here rather than re-describing the upstream workflow.
⚠️ Everything below applies to the old XMLUI-based releases (lindat-dspace) and is kept for historical reference. It does not apply to v7+.
These instructions describe the steps to provide the repository in a different
language, mirroring the changes in
#459 and
0e1454
(minus the *.java/*.xsl work that internationalized missed strings). To jump
start translations, check whether upstream DSpace was already translated into the
target language (see the old
dspace-xmlui-lang
project).
Configuration — set supported.locales in local.properties, e.g.
supported.locales = en, cs.
Translating the UI — most UI strings are in messages.xml; provide a
messages_LOC.xml (where LOC is the locale). Start from
messages.template
placed into
dspace/modules/xmlui/.../i18n.
The rest live in JS files (each carrying its own dictionary); search for
i18n.load and provide your translation in:
./dspace-xmlui/src/main/webapp/themes/UFAL/lib/js/dragndrop.js
./dspace-xmlui/src/main/webapp/themes/UFAL/lib/js/fileupload.js
./dspace-xmlui/src/main/webapp/themes/UFAL/lib/bootstrap/js/ufal.min.js
If you changed input-forms.xml you'll need matching message keys; this gist can help generate them. Forms can be overlaid.
Translating static content — put translations into
/dspace-xmlui/.../html/LOC;
check the cs/ dir to see which files need translating. Files come in .xml +
.html pairs (the .html must be well-formed XML). The dummy.* files provide
the "no translation yet" fallback. The selection
logic
is based on URL and locale.
Deposition license — if per-collection licenses are not set,
default.license
is shown/stored; for non-English locales an alternative license is shown on
/xmlui/page/contract (the default one is still stored). See
#491.
Flags — language-switch flags are part of lindat common, expected under
/themes/UFAL/lib/lindat/public/img/flags/.
By 2017.04 the JS message system changed to per-locale messages_LOC.js files.
To localise:
- Determine the two-letter locale code (e.g.
de). - Copy the English sources to locale versions:
- XML:
dspace-xmlui/.../i18n/messages.xml→dspace/modules/xmlui/.../i18n/messages_de.xml - JS:
dspace-xmlui/.../js/messages/messages.js→.../js/messages/messages_de.js - license:
dspace/config/licenses/default.license→dspace/config/licenses/alternative_de.license
- XML:
- Create a locale subdir (e.g.
.../UFAL/lib/html/de/) with copies of the static HTML pages. - Translate the XML/JS messages, license, and static HTML.
- Set the locale in the last line of the JS file, e.g.
jQuery.i18n.load('de', messages);. - Update the front-end (with lindat-common: add a flag icon and translated header/footer).
- Add the locale to
supported.localesinlocal.properties. - Open a PR to include your XML/JS message and license translations (see Code contributions).
Updating an installation localised before 2017.04 — your XML mostly still
works, but migrate the JS: create messages_de.js, set the locale, then fold the
i18n.load blocks from the other JS files (e.g. dragndrop.js) into it and
delete those blocks.
Checking message keys when upgrading — there may be new/changed keys:
$ python utilities/project_helpers/scripts/check-message-translations.py de
$ python utilities/project_helpers/scripts/check-message-usages.py de
(The second is less reliable since some keys are generated dynamically.)
Getting Started
Features
- All Features — full categorised list
- CLARIN Licenses
- PIDs & Handles
- Featured Services / Refbox
- Field-Level Permissions
- File Previews
- Sharing a Submission
- Personal Access Tokens
- DOI Configuration per Community
- ROR Authority
Operations
- Kubernetes Deployment
- Samples (.env, Nginx)
- Nginx + Shibboleth
- Handle Server · Setup (v7)
- Shibboleth · DiscoJuice
- Shibboleth Accounts
- S3 Storage · CESNET S3
- Google Analytics
- Matomo
- Solr
- Logging
- Custom Namespace
- Health Report
For Users
Development
Reference
- Authorizations
- Metadata Info
- Citations (proposal)
- Repository Checklist
- Search, Browse & Filters
- Localization
- Importing Items (CLI)
- NFA Import - Steps
- OpenAIRE
- DOI Registration
- Inclusion in OLAC
- Unit Testing
- Deploy Checks
- Troubleshooting
- Versioning Theory
- Dynamic Resource Versioning
- Metashare Import · Schema
- Web Server Overview
- LINDAT Common Theme
- Workshop 2016 Results
- WebLicht Integration
- Google Dataset Search
Archive (v5 / stale)
- Old Home (v5)
- Installation (v5)
- Prerequisites (v5)
- Connecting Tomcat with Apache
- Using Apache
- Building Shibboleth FastCGI
- Shibboleth Install (v5)
- EUDAT Replication
- Backup (v5)
- Spring Social / Google Drive (v5)
- Clarin (→ Repository Checklist)
- Control Panel (v5)
- Overlays (v5)
- Configuration (v5)
- Speeding Up Downloads
- Debugging (v5)
- Selenium (v5)
- Code Contributions (v5)
- Best Practices (v5)
- Testing Hudson
- Working on Windows
- Prerequisites Checklist (v5)
- Migration to DSpace 7.2.1
- Upgrade From Lindat
- Piwik (→ Matomo) · Piwik Cleaning