Skip to main content
The bundle supports per-locale labels on menu items. Each item has a base label field plus a JSON translations map keyed by locale code. At render time, the bundle selects the right label based on the current request locale and your locale configuration.

Options

locales
string[]
default:"[]"
The list of locales enabled for menu item labels (e.g. ['en', 'es', 'fr']). When this list is empty, the request locale is used as-is with no validation.
default_locale
string|null
default:"null"
The fallback locale used when the request locale is not present in locales. When null, the first entry in locales is used as the fallback.
config/packages/nowo_dashboard_menu.yaml
nowo_dashboard_menu:
    locales: ['en', 'es', 'fr']
    default_locale: 'en'

Locale resolution

When a menu is rendered, the bundle resolves the locale to use for item labels in this order:
1

Read the request locale

The current Symfony request locale is read (e.g. es).
2

Check against enabled locales

If locales is non-empty, the request locale is checked against the list. If it matches, it is used.
3

Fall back to the default locale

If the request locale is not in locales, default_locale is used. When default_locale is null, the first entry in locales is used instead.
When locales is empty, the request locale is used as-is. No fallback is applied. This is useful during development when you want to match whatever locale Symfony currently reports.
Each menu item stores:
  • label — the base label, used as the default when no translation is found for the resolved locale.
  • translations — a JSON object mapping locale codes to translated labels, for example {"es": "Inicio", "fr": "Accueil"}.
You manage translations through the dashboard item form or directly in your database fixtures.

Example: multi-language setup

config/packages/nowo_dashboard_menu.yaml
nowo_dashboard_menu:
    locales: ['en', 'es', 'fr', 'de']
    default_locale: 'en'
With this configuration:
  • A request with locale fr uses the French label if available, otherwise falls back to label.
  • A request with locale pt (not in the list) uses en labels.
  • A request with locale en uses the English label if available, otherwise label.