Internationalization #
The aFP Design System include a built-in internationalization (i18n) system to make the UI available in multiple languages. You can set the active language, provide your own translations, and remove or override existing ones — without rebuilding the application.
Change language #
The selected language only applies to this browser tab and for the current session. When you close the tab or open
the documentation in a new tab, the language will reset to its default.
Note that this setting only changes the language of the UI components
(such as ARIA labels and other accessibility-related texts), not the language of the overall documentation content.
Deutsch
Setzt die Sprache auf Deutsch (nur ARIA-Labels & UI-Texte).
de
English
Sets language to English (ARIA labels & UI texts).
en
How it works #
The i18n system stores translation dictionaries for each language.
When a component needs to display text, it looks up the correct translation for the current language. If no translation is found for the active language, the fallback language (en by default) is used.
You can:
All components that are registered for i18n will automatically re-render when the language changes.
Functions #
Set language #
setAfpLanguage(code: string) #
Sets the active language for all i18n-enabled components.
code: A language code (e.g. "en", "de-DE").
Only the base part is used ("de-DE" becomes "de").
- If you pass a code that is not recognized, the fallback language is used instead.
- Automatically refreshes the text in all registered components.
import { setAfpLanguage } from '@afp-design-system/core';
setAfpLanguage('de');
setAfpLanguage('en');
Get language #
getAfpLanguage(): string #
Returns the language currently in use. If no language has been set yet, it will:
- Try to detect the browser's preferred language.
- Use the fallback language (
en) if detection fails.
import { getAfpLanguage } from '@afp-design-system/core';
console.log(getAfpLanguage());
Register translation #
registerAfpTranslation(code: string, dict: AfpTranslationDict) #
Adds or overrides translations for one language.
code: Language code (e.g. "fr").
dict: An object with translation keys and their translated text.
- If you register a dictionary for the currently active language, the UI updates immediately.
import { registerAfpTranslation } from '@afp-design-system/core';
registerAfpTranslation('fr', {
'afp-badge.aria-label': 'Badge de statut'
});
Register multiple translations #
registerAfpTranslations(bundle: AfpTranslation) #
Adds or overrides translations for multiple languages in one call.
bundle: An object where each key is a language code and each value is its dictionary.
import { registerAfpTranslation } from '@afp-design-system/core';
registerAfpTranslations({
fr: { 'afp-badge.aria-label': 'Badge de statut' },
es: { 'afp-badge.aria-label': 'Insignia de estado' }
});
Unregister translation #
unregisterAfpTranslation(code: string) #
Removes the translation dictionary for a language.
code: Language code to remove.
- Does nothing if the code is invalid or not currently registered.
import { unregisterAfpTranslation } from '@afp-design-system/core';
unregisterAfpTranslation('fr');
Default Translations #
These translations are included by default. You can override them at any time by registering your own dictionaries.
Alert Close
Avatar
Avatar Group
Badge
Breadcrumb
Breadcrumb Item
Button Group
Checkbox
Checkbox Group
Color Picker
Copy Button
Date Picker
File Upload
Input
Option
Password Validator
Pin Input
Progress Bar
Progress Ring
Radio
Radio Card
Radio Group
Select
Slider
Stepper
Table
Tag
Textarea
Timeline
Timeline Item
All
| Key | en | de |
alert-close.aria-label |
Close alert |
Benachrichtigung schließen |
| Key | en | de |
avatar.aria-label |
Avatar |
Avatar |
avatar.img.alt |
Avatar |
Avatar |
| Key | en | de |
avatar-group.aria-label |
Avatar group |
Avatar-Gruppe |
avatar-group.count-text |
%s more avatars are hidden. |
%s weitere Avatare sind ausgeblendet. |
| Key | en | de |
badge.aria-label |
Status badge |
Statusabzeichen |
| Key | en | de |
breadcrumb.aria-label |
Breadcrumb navigation |
Breadcrumb-Navigation |
breadcrumb.dropdown-label |
Hidden breadcrumb items |
Versteckte Breadcrumb-Elemente |
breadcrumb.ellipsis-label |
Show hidden breadcrumb items |
Versteckte Breadcrumb-Elemente anzeigen |
| Key | en | de |
breadcrumb-item.current-page |
Current page |
Aktuelle Seite |
| Key | en | de |
button-group.aria-label |
Button group |
Button-Gruppe |
| Key | en | de |
checkbox.aria-label |
Checkbox |
Checkbox |
| Key | en | de |
checkbox-group.aria-label |
Checkbox group |
Checkbox-Gruppe |
| Key | en | de |
color-picker.aria-label |
Choose color |
Farbe auswählen |
| Key | en | de |
copy-button.aria-label |
Copy text |
Text kopieren |
copy-button.success |
Copied successfully |
Erfolgreich kopiert |
| Key | en | de |
date-picker.month.april |
April |
April |
date-picker.month.august |
August |
August |
date-picker.month.december |
December |
Dezember |
date-picker.month.february |
February |
Februar |
date-picker.month.january |
January |
Januar |
date-picker.month.july |
July |
Juli |
date-picker.month.june |
June |
Juni |
date-picker.month.march |
March |
März |
date-picker.month.may |
May |
Mai |
date-picker.month.november |
November |
November |
date-picker.month.october |
October |
Oktober |
date-picker.month.september |
September |
September |
date-picker.weekday.fri |
Friday |
Freitag |
date-picker.weekday.mon |
Monday |
Montag |
date-picker.weekday.sat |
Saturday |
Samstag |
date-picker.weekday.sun |
Sunday |
Sonntag |
date-picker.weekday.thu |
Thursday |
Donnerstag |
date-picker.weekday.tue |
Tuesday |
Dienstag |
date-picker.weekday.wed |
Wednesday |
Mittwoch |
| Key | en | de |
file-upload.remove-file.aria-label |
Remove file |
Datei entfernen |
file-upload.retry-upload-file.aria-label |
Retry upload file |
Datei erneut hochladen |
| Key | en | de |
input.clear-button.aria-label |
Clear input |
Eingabe löschen |
input.password-toggle.hide |
Hide password |
Passwort ausblenden |
input.password-toggle.show |
Show password |
Passwort anzeigen |
| Key | en | de |
option.close-button.aria-label |
Remove selection |
Auswahl entfernen |
| Key | en | de |
password-validator.rule.fulfilled |
fulfilled |
erfüllt |
password-validator.rule.unfulfilled |
not fulfilled |
nicht erfüllt |
password-validator.rules.aria-label |
Password requirements |
Passwortanforderungen |
| Key | en | de |
pin-input.digit |
Digit %s of %s |
Ziffer %s von %s |
| Key | en | de |
progress-bar.aria-label |
Progress bar |
Fortschrittsanzeige |
| Key | en | de |
progress-ring.aria-label |
Progress ring |
Fortschrittsring |
| Key | en | de |
radio.aria-label |
Radio |
Radio |
| Key | en | de |
radio-card.aria-label |
Radio card |
Radio-Karte |
| Key | en | de |
radio-group.aria-label |
Radio group |
Radio-Gruppe |
| Key | en | de |
select.clear-button.aria-label |
Clear selection |
Auswahl löschen |
select.search-field.aria-label |
Search options |
Optionen durchsuchen |
select.search-field.placeholder |
Search... |
Suchen... |
| Key | en | de |
slider.aria-label |
Slider |
Schieberegler |
| Key | en | de |
stepper.aria-label |
Stepper |
Stepper |
| Key | en | de |
table.pagination.page |
Page %s of %s |
Seite %s von %s |
table.pagination.selected |
%s selected |
%s ausgewählt |
table.pagination.total-items |
%s item(s) |
%s insgesamt |
| Key | en | de |
tag.close.aria-label |
Close tag |
Tag schließen |
| Key | en | de |
textarea.clear-button.aria-label |
Clear textarea |
Textbereich löschen |
| Key | en | de |
timeline.aria-label |
Timeline |
Zeitleiste |
| Key | en | de |
timeline-item.aria-label |
Timeline item |
Zeitleiste Eintrag |
| Key | en | de |
avatar.aria-label | Avatar | Avatar |
avatar.img.alt | Avatar | Avatar |
avatar-group.aria-label | Avatar group | Avatar-Gruppe |
avatar-group.count-text | %s more avatars are hidden. | %s weitere Avatare sind ausgeblendet. |
checkbox.aria-label | Checkbox | Checkbox |
checkbox-group.aria-label | Checkbox group | Checkbox-Gruppe |
button-group.aria-label | Button group | Button-Gruppe |
badge.aria-label | Status badge | Statusabzeichen |
tag.close.aria-label | Close tag | Tag schließen |
progress-bar.aria-label | Progress bar | Fortschrittsanzeige |
progress-ring.aria-label | Progress ring | Fortschrittsring |
alert-close.aria-label | Close alert | Benachrichtigung schließen |
radio.aria-label | Radio | Radio |
radio-card.aria-label | Radio card | Radio-Karte |
radio-group.aria-label | Radio group | Radio-Gruppe |
input.password-toggle.hide | Hide password | Passwort ausblenden |
input.password-toggle.show | Show password | Passwort anzeigen |
input.clear-button.aria-label | Clear input | Eingabe löschen |
textarea.clear-button.aria-label | Clear textarea | Textbereich löschen |
select.clear-button.aria-label | Clear selection | Auswahl löschen |
select.search-field.placeholder | Search... | Suchen... |
select.search-field.aria-label | Search options | Optionen durchsuchen |
option.close-button.aria-label | Remove selection | Auswahl entfernen |
copy-button.aria-label | Copy text | Text kopieren |
copy-button.success | Copied successfully | Erfolgreich kopiert |
date-picker.weekday.sun | Sunday | Sonntag |
date-picker.weekday.mon | Monday | Montag |
date-picker.weekday.tue | Tuesday | Dienstag |
date-picker.weekday.wed | Wednesday | Mittwoch |
date-picker.weekday.thu | Thursday | Donnerstag |
date-picker.weekday.fri | Friday | Freitag |
date-picker.weekday.sat | Saturday | Samstag |
date-picker.month.january | January | Januar |
date-picker.month.february | February | Februar |
date-picker.month.march | March | März |
date-picker.month.april | April | April |
date-picker.month.may | May | Mai |
date-picker.month.june | June | Juni |
date-picker.month.july | July | Juli |
date-picker.month.august | August | August |
date-picker.month.september | September | September |
date-picker.month.october | October | Oktober |
date-picker.month.november | November | November |
date-picker.month.december | December | Dezember |
color-picker.aria-label | Choose color | Farbe auswählen |
file-upload.remove-file.aria-label | Remove file | Datei entfernen |
file-upload.retry-upload-file.aria-label | Retry upload file | Datei erneut hochladen |
slider.aria-label | Slider | Schieberegler |
breadcrumb.aria-label | Breadcrumb navigation | Breadcrumb-Navigation |
breadcrumb.ellipsis-label | Show hidden breadcrumb items | Versteckte Breadcrumb-Elemente anzeigen |
breadcrumb.dropdown-label | Hidden breadcrumb items | Versteckte Breadcrumb-Elemente |
breadcrumb-item.current-page | Current page | Aktuelle Seite |
password-validator.rules.aria-label | Password requirements | Passwortanforderungen |
password-validator.rule.fulfilled | fulfilled | erfüllt |
password-validator.rule.unfulfilled | not fulfilled | nicht erfüllt |
timeline.aria-label | Timeline | Zeitleiste |
timeline-item.aria-label | Timeline item | Zeitleiste Eintrag |
pin-input.digit | Digit %s of %s | Ziffer %s von %s |
stepper.aria-label | Stepper | Stepper |
table.pagination.total-items | %s item(s) | %s insgesamt |
table.pagination.selected | %s selected | %s ausgewählt |
table.pagination.page | Page %s of %s | Seite %s von %s |
Notes #
- Placeholders like
%s will be replaced by the arguments passed to the translation function.
- The system is case-insensitive for language codes (
"DE", "de", and "de-DE" are treated the same).
- You do not need to translate all keys for every language — missing keys will fall back to the default language.