Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
19e7af3
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 14, 2025
9a243fa
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 14, 2025
d902569
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 14, 2025
348bc29
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 14, 2025
2822628
Merge branch 'redhat-developer:main' into RHIDP-8635-1
Gerry-Forde Oct 28, 2025
fe7f1d5
Update modules/customizing-the-appearance/proc-adding-localization-to…
Gerry-Forde Oct 28, 2025
a0336d1
Update modules/customizing-the-appearance/proc-adding-localization-to…
Gerry-Forde Oct 28, 2025
31ea439
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 28, 2025
4a64905
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 28, 2025
fead28b
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 28, 2025
0ac0c53
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 28, 2025
7128efc
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 28, 2025
9e9d9b6
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
8a80b35
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
c27782c
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
a357528
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
851d313
Update modules/customizing-the-appearance/con-language-persistence.adoc
Gerry-Forde Oct 30, 2025
863e698
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
a854520
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
1d2299b
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
f80edec
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
b4acbb6
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
27f76d4
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
c2d345e
Update modules/customizing-the-appearance/ref-best-practices-for-loca…
Gerry-Forde Oct 30, 2025
744683b
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Oct 30, 2025
a32ba21
Update modules/customizing-the-appearance/proc-adding-localization-to…
Gerry-Forde Oct 30, 2025
0285a12
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 31, 2025
77316ca
Merge branch 'main' into RHIDP-8635-1
Gerry-Forde Oct 31, 2025
7bc89c6
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 31, 2025
c7461be
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Oct 31, 2025
064d75b
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Nov 2, 2025
91c380a
Merge branch 'main' into RHIDP-8635-1
Gerry-Forde Nov 2, 2025
63b8069
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Nov 2, 2025
b8fa956
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Nov 2, 2025
a6cde1f
Update modules/customizing-the-appearance/proc-enabling-localization-…
Gerry-Forde Nov 6, 2025
cac8ecd
Update modules/configuring-a-floating-action-button/con-localization-…
Gerry-Forde Nov 6, 2025
b433927
Update modules/configuring-a-floating-action-button/con-localization-…
Gerry-Forde Nov 6, 2025
5467d90
Update modules/customizing-the-appearance/proc-enabling-localization-…
Gerry-Forde Nov 6, 2025
fb5e8a4
Update modules/customizing-the-appearance/proc-enabling-localization-…
Gerry-Forde Nov 6, 2025
8d43fec
Update modules/customizing-the-appearance/proc-overriding-translation…
Gerry-Forde Nov 6, 2025
fab4990
Update modules/customizing-the-appearance/proc-enabling-localization-…
Gerry-Forde Nov 6, 2025
0ed67ed
Update modules/configuring-a-floating-action-button/con-localization-…
Gerry-Forde Nov 6, 2025
6d9b857
Update modules/customizing-the-appearance/proc-enabling-localization-…
Gerry-Forde Nov 6, 2025
7e76a5f
Update modules/configuring-a-floating-action-button/con-localization-…
Gerry-Forde Nov 6, 2025
7e26249
Update modules/configuring-a-floating-action-button/con-localization-…
Gerry-Forde Nov 6, 2025
4afcc34
Update modules/configuring-a-floating-action-button/con-localization-…
Gerry-Forde Nov 6, 2025
5550874
Update modules/configuring-a-floating-action-button/proc-configuring-…
Gerry-Forde Nov 6, 2025
959a988
Update modules/configuring-a-floating-action-button/proc-configuring-…
Gerry-Forde Nov 6, 2025
629fd9f
Update modules/customizing-the-appearance/con-language-persistence.adoc
Gerry-Forde Nov 6, 2025
f0cb2d3
Merge branch 'main' into RHIDP-8635-1
Gerry-Forde Nov 6, 2025
eee8f7f
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Nov 6, 2025
1784af9
Merge branch 'main' into RHIDP-8635-1
Gerry-Forde Nov 6, 2025
ad0722c
Merge branch 'redhat-developer:main' into RHIDP-8635-1
Gerry-Forde Nov 7, 2025
4e5f01e
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Nov 7, 2025
5908549
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Nov 8, 2025
20814c7
Merge branch 'main' into RHIDP-8635-1
Gerry-Forde Nov 8, 2025
1cdf284
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Nov 8, 2025
2b31419
RHIDP-8635-1 - Comprehensive documentation for developers on adding l…
Gerry-Forde Nov 8, 2025
a9120d4
RHIDP-8635-1 - [testday] Fix typo in localisation docs
Gerry-Forde Nov 8, 2025
3b42cd3
RHIDP-8635-1 - [testday] Localization: Add link to oc installation
Gerry-Forde Nov 8, 2025
6ef43d3
RHIDP-8634-2 - [testday] Localization: Update enablement and language…
Gerry-Forde Nov 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assemblies/assembly-configuring-a-floating-action-button.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ You can use the floating action button plugin to configure any action as a float

include::modules/configuring-a-floating-action-button/proc-configuring-floating-action-button-as-a-dynamic-plugin.adoc[leveloffset=+1]

// Localization
include::modules/configuring-a-floating-action-button/con-localization-support-for-the-floating-action-button.adoc[leveloffset=+1]
// END Localization

include::modules/configuring-a-floating-action-button/ref-floating-action-button-parameters.adoc[leveloffset=+1]
2 changes: 1 addition & 1 deletion assemblies/assembly-configuring-the-quickstarts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ include::modules/configuring-the-quickstarts/proc-disabling-rhdh-quickstart.adoc

include::modules/configuring-the-quickstarts/proc-starting-and-completing-modules-in-quickstarts.adoc[leveloffset=+1]

include::modules/configuring-the-quickstarts/con-using-rbac-with-quickstarts.adoc[leveloffset=+1]
include::modules/customizing-the-appearance/proc-enabling-localization-in-quickstarts.adoc[leveloffset=+1]
2 changes: 2 additions & 0 deletions assemblies/assembly-customizing-the-appearance.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ include::modules/customizing-the-appearance/con-about-rhdh-sidebar-menuitems.ado

include::modules/customizing-the-appearance/proc-customize-rhdh-sidebar-menuitems.adoc[leveloffset=+2]

include::modules/customizing-the-appearance/proc-enabling-localization-in-sidebar-items.adoc[leveloffset=+2]

include::modules/customizing-the-appearance/proc-configuring-dynamic-plugin-menuitem.adoc[leveloffset=+2]

include::modules/customizing-the-appearance/proc-modifying-or-adding-rhdh-custom-menuitem.adoc[leveloffset=+2]
Expand Down
26 changes: 26 additions & 0 deletions assemblies/assembly-localization-in-rhdh.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
:_mod-docs-content-type: ASSEMBLY
:context: assembly-localization-in-rhdh

[id="assembly-localization-in-rhdh_{context}"]
= Localization in {product}

include::modules/customizing-the-appearance/proc-enabling-localization-in-rhdh.adoc[leveloffset=+1]

include::modules/customizing-the-appearance/proc-select-rhdh-language.adoc[leveloffset=+1]

include::modules/customizing-the-appearance/con-language-persistence.adoc[leveloffset=+2]

// include::modules/customizing-the-appearance/proc-enabling-localization-in-quickstarts.adoc[leveloffset=+1]

// include::modules/customizing-the-appearance/proc-enabling-localization-in-sidebar-items.adoc[leveloffset=+1]

//include::modules/customizing-the-appearance/proc-enabling-localization-in-floating-action-button.adoc[leveloffset=+1]

== Localization support for plugins

include::modules/customizing-the-appearance/proc-overriding-translations.adoc[leveloffset=+2]

include::modules/customizing-the-appearance/ref-best-practices-for-localization.adoc[leveloffset=+2]

include::modules/customizing-the-appearance/proc-adding-localization-to-custom-plugins.adoc[leveloffset=+2]

Binary file added images/rhdh/customize-language-dropdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[id="proc-enabling-localization-in-floating-action-button_{context}"]
= Enabling floating action button localization in {product-very-short}

You can enable translation key support for floating action buttons, so that users can onboard in their preferred language. In {product-short}, all existing and newly created floating action buttons support localization using dedicated translation keys.

The Global Floating Action Button plugin supports internationalization (i18n) through translation keys. You can use `labelKey` and `toolTipKey` properties to provide translation keys instead of static text.

The plugin provides the following built-in translation keys organized under the `fab` namespace:

* `fab.create.label` - "Create"
* `fab.create.tooltip` - "Create entity"
* `fab.docs.label` - "Docs"
* `fab.docs.tooltip` - "Documentation"
* `fab.apis.label` - "APIs"
* `fab.apis.tooltip` - "API Documentation"
* `fab.github.label` - "GitHub"
* `fab.github.tooltip` - "GitHub Repository"
* `fab.bulkImport.label` - "Bulk Import"
* `fab.bulkImport.tooltip` - "Register multiple repositories in bulk"
* `fab.quay.label` - "Quay"
* `fab.quay.tooltip` - "Quay Container Registry"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should also be mentioned that if users want to support localization for a new FAB item, add any arbitrary keys for labelKey and toolTipKey, they must also provide corresponding translations for those keys. This process is similar to what’s described in the Quickstart documentation:
Enabling localization in Quickstarts 3. In your translation file, map the keys from the first step to the localized strings for each supported language.
allTranslations.json can look like

{
...,
  "plugin.global-floating-action-button": {
    "en": {
        "fab.app.label": "My Application En",
        "fab.app.tooltip": "Red Hat Developer Hub En"
    },
    "fr": {
        "fab.app.label": "My Application Fr",
        "fab.app.tooltip": "Red Hat Developer Hub Fr"
    }
  }
...,
}

The plugin includes translations for the following supported languages:

* English (default)
// * German (de)
* French (fr)
// * Spanish (es)

// [NOTE]
// ====
// To add localization support for a new floating action button item, you can add any arbitrary key name for the `labelKey` and `toolTipKey` properties and provide corresponding translations for those keys.

// If you add a new floating action button item, you can add localization support by adding an arbitary label key and tool tip key

// ====

To ensure backward compatibility while providing translation support when available, the following order is used to resolve string translations:

. If the `labelKey` is provided, the plugin will attempt to resolve the translation key
. If the translation key is found, it will be used as the label
. If the translation key is not found, the plugin will fall back to the label property

[NOTE]
====
The same logic applies to `toolTipKey` and `toolTip`.
====

== Internal translation implementation
The plugin uses a centralized translation system where:

* The `useTranslation()` hook is called in components that render floating action buttons to ensure proper translation context initialization
* The translation function (`t`) is passed down to child components that need to resolve translation keys
* This internal architecture prevents infinite re-render loops and ensures stable component rendering
* All components that use `CustomFab` must provide the translation function as a prop

[NOTE]
====
When extending or modifying the plugin components, ensure that the `useTranslation()` hook is called in parent components and the `t` prop is passed to `CustomFab` instances to maintain proper translation functionality and prevent rendering issues.
====
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,43 @@ To configure a floating action button as a dynamic plugin, complete any of the f
text: Bulk import
----
`frontend:mountPoints:importName`:: Enter the import name with an associated component to the mount point.

= Translation support
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@its-mitesh-kumar Could you please provide a technical review of this section of the guide.

The Global Floating Action Button plugin supports internationalization (i18n) through translation keys. You can use `labelKey` and `toolTipKey` properties to provide translation keys instead of static text.

Example for using translation keys in dynamic configuration:
[source,yaml]
----
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-floating-action-button
disabled: false
pluginConfig:
dynamicPlugins:
frontend:
red-hat-developer-hub.backstage-plugin-global-floating-action-button:
translationResources:
- importName: globalFloatingActionButtonTranslations
ref: globalFloatingActionButtonTranslationRef
mountPoints:
- mountPoint: application/listener
importName: DynamicGlobalFloatingActionButton
- mountPoint: global.floatingactionbutton/config
importName: NullComponent
config:
icon: github
label: 'GitHub' # Fallback text
labelKey: 'fab.github.label' # Translation key
toolTip: 'GitHub Repository' # Fallback text
toolTipKey: 'fab.github.tooltip' # Translation key
to: https://github.com/redhat-developer/rhdh-plugins
- mountPoint: global.floatingactionbutton/config
importName: NullComponent
config:
color: 'success'
icon: search
label: 'Create' # Fallback text
labelKey: 'fab.create.label' # Translation key
toolTip: 'Create entity' # Fallback text
toolTipKey: 'fab.create.tooltip' # Translation key
to: '/create'
showLabel: true
----
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ Use the parameters as shown in the following table to configure your floating ac
| Not applicable
| Yes

| `labelKey`
| Translation key for the label. If provided, will be used instead of label when translations are available.
| `String`
| Not applicable
| No

| `icon`
| Icon of the floating action button. Recommended to use filled icons from the link:https://fonts.google.com/icons[Material Design library]. You can also use an svg icon. For example: `<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#e8eaed"><g><rect fill="none" height="24" width="24"/></g><g><path d="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5-5L11,7z M20,19h-8v2h8c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2h-8v2h8V19z"/></g></svg>`
| `String`, `React.ReactElement`, `SVG image icon`, `HTML image icon`
Expand Down Expand Up @@ -63,6 +69,12 @@ Use the parameters as shown in the following table to configure your floating ac
| Not applicable
| No

| `toolTipKey`
| Translation key for the tooltip. If provided, will be used instead of toolTip when translations are available.
| `String`
| Not applicable
| No

| `priority`
| Order of the floating action buttons displayed in the submenu. A larger value means higher priority.
| `number`
Expand Down
27 changes: 27 additions & 0 deletions modules/customizing-the-appearance/con-language-persistence.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
:_mod-docs-content-type: CONCEPT

[id="con-language-persistence_{context}"]
= Language persistence

When you change the language in the UI, your preference is saved to storage. On next login or refresh, your chosen language setting is restored. Guest users cannot persist language preferences.

Default language selection uses the following priority order:

. *Browser language priority*: The system first checks the user's browser language preferences to provide a personalized experience.

. *Configuration priority*: If no browser language matches the supported locales, the `defaultLocale` from the `i18n` configuration is used as a fallback.

. *Fallback priority*: If neither browser preferences nor configuration provide a match, defaults to `en`.

{product} automatically saves and restores user language settings across browser sessions. This feature is enabled by default and uses database storage. To opt-out and use browser storage instead, add the following to your `{my-app-config-file}` configuration file:
[source,yaml,subs="+quotes"]
----
userSettings:
persistence: browser
----

where:

userSettings:persistence::
Enter `browser` to opt-out and use browser local storage. Optionally, set this value to `database` to persist across browsers and devices. This is the default setting and does not require this configuration to be set.

Loading