Translations and Icons 

Every text of the interface exists in English and German, in XLIFF catalogues used by PHP, Fluid templates and the TypeScript frontend. Icons come from the Lucide icon set or from the package.

Catalogues 

A package puts its catalogues in translations/, one file per language:

packages/web-vision/adsum-working-time/translations/
    messages+intl-icu.en.xlf
    messages+intl-icu.de.xlf
Copied!

Both files have exactly the same keys; English is the fallback. The files are XLIFF 2.0, one <unit> per message, with the key as source and the text as target:

<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en" trgLang="en">
  <file id="messages">
    <unit id="nav.myWorkingDays" name="nav.myWorkingDays">
      <segment>
        <source>nav.myWorkingDays</source>
        <target>My working days</target>
      </segment>
    </unit>
  </file>
</xliff>
Copied!

In the German file trgLang is de and the target is the German text. id and name repeat the key.

Keys 

Keys are camelCase words separated by dots. Common prefixes:

  • nav. for entries of the navigation (nav.myDays) and nav.group. for its groups
  • screen. for titles, labels and values on screens (screen.model.code, screen.model.scheduleType.fixed)
  • notification.type.<key>.title and notification.type.<key>.body for notifications (see Notifications and Live Updates)
  • clock. for the clock of the attendance package

Prefix keys with the topic of the package.

Message format 

Messages use ICU MessageFormat: placeholders in curly braces, plural and select for counts and alternatives:

<target>{count, plural, one {# missing punch in your team} other {# missing punches in your team}}</target>
<target>{requesterName} and {colleagueName} swapped, {approved, select, yes {approved} other {rejected}}.</target>
Copied!

Use translations 

In PHP, inject Symfony\Contracts\Translation\TranslatorInterface and pass the placeholders as parameters:

$text = $this->translator->trans('notification.type.time.workOnAbsence.body', ['employeeName' => $name, 'date' => $date], 'messages', $locale);
Copied!

In TypeScript, translate() takes the key and the values of the placeholders:

import { translate } from '@adsum/core/i18n/translations.js';

const text = translate('clock.state.working.since', { time });
Copied!

In Fluid templates, use the ViewHelper tt:translate. Further arguments are placeholders:

<html data-namespace-typo3-fluid="true"
      xmlns:tt="http://typo3.org/ns/WebVision/Adsum/Core/Shared/View/ViewHelpers">
<tt:translate key="screen.model.title"/>
<tt:translate key="notification.type.time.workOnAbsence.body" employeeName="{name}" date="{date}"/>
</html>
Copied!

The frontend loads public/translations/<locale>.json of each package, built from the XLIFF files, in the language of the user's account with English as the fallback.

Check the catalogues 

Build/Scripts/runTests.sh -s checkIntegrityXliff checks that all languages have the same keys and that every key used in a template or component is defined.

Icons 

The icons a package uses are listed in Build/Sources/Icons/<package>/icons.json:

[
    "calendar-check",
    "calendar-clock",
    "repeat",
    "settings-2"
]
Copied!

Every name is a Lucide icon. An SVG file of the same name next to icons.json replaces it or adds an own icon. The build copies the icons to public/icons/<name>.svg of the package. An icon name can be used:

  • as icon of a navigation entry (see Navigation and Access)
  • as icon of a row action of a screen (see Screens)
  • in a component, with <wa-icon library="adsum" name="clock"></wa-icon>