Skip to content

Translations ​

The Vue and React components ship with English text for their buttons, tabs, empty states, error toasts, and screen reader labels. You may override any or all of it with setTranslations().

The text of your toasts and notifications comes from your Laravel application, which translates it with its own translator. See the translation of toasts and of notifications.

Setting Translations ​

Import setTranslations() and pass it the translations you want to change. Register them once in your app entry file, before createInertiaApp():

js
import { initNotifications, setTranslations } from '@inertiaui/notifications-vue'

setTranslations({
    inbox_title: 'Meldingen',
    inbox_mark_all_as_read: 'Alles als gelezen markeren',
    inbox_archive: 'Archiveren',
    toast_dismiss: 'Sluiten: :title',
})

initNotifications()
js
import { initNotifications, setTranslations } from '@inertiaui/notifications-react'

setTranslations({
    inbox_title: 'Meldingen',
    inbox_mark_all_as_read: 'Alles als gelezen markeren',
    inbox_archive: 'Archiveren',
    toast_dismiss: 'Sluiten: :title',
})

initNotifications()

setTranslations() merges your translations with the current ones, so the keys you leave out keep their text.

Placeholders ​

String values use :name placeholders, which the component replaces with its parameters:

js
setTranslations({
    inbox_bell_new: 'Meldingen, :count nieuw',
    inbox_snoozed_until: 'Gesnoozed tot :time',
})

The available translations list the parameters of each key.

Plurals and Custom Formatting ​

For text that needs plurals or custom formatting, pass a function instead of a string. The function receives the same parameters as the placeholders and returns the text:

js
import { setTranslations } from '@inertiaui/notifications-vue'

setTranslations({
    inbox_show_more: ({ count }) => (count === 1 ? 'Nog 1 melding tonen' : `Nog ${count} meldingen tonen`),
})
js
import { setTranslations } from '@inertiaui/notifications-react'

setTranslations({
    inbox_show_more: ({ count }) => (count === 1 ? 'Nog 1 melding tonen' : `Nog ${count} meldingen tonen`),
})

The inbox_bell_new translation receives the count as the badge shows it, such as "99+", as count, and the number itself as number. This lets you choose the plural form for a capped count too:

js
setTranslations({
    inbox_bell_new: ({ count, number }) => `Notifications, ${count} new ${number === 1 ? 'message' : 'messages'}`,
})

Both packages export the type of a translation as TranslationValue.

Storing Translations in a Separate File ​

You may store the translations in a separate file. For example, create a nl.json file in your resources/js directory:

json
{
    "inbox_title": "Meldingen",
    "inbox_mark_all_as_read": "Alles als gelezen markeren"
}

Then import the file and pass it to setTranslations():

js
import { setTranslations } from '@inertiaui/notifications-vue'
import nl from './nl.json'

setTranslations(nl)
js
import { setTranslations } from '@inertiaui/notifications-react'
import nl from './nl.json'

setTranslations(nl)

Overriding Text for One Component ​

A component's text props take the place of the translations for that one component, so a page may use its own wording:

Prop or optionTranslations it replaces
label of the Toastertoaster_label
dismissLabel of the Toastertoast_dismiss
typeLabels of the Toastertoast_type_
labels of the NotificationCenter and the NotificationListinbox_
labels of the NotificationPreferencespreferences_
errorToasts of initNotifications()error_toast_

The labels props take the keys in camel case, without their prefix, such as markAllAsRead for inbox_mark_all_as_read. Their values may be functions too:

vue
<NotificationCenter :labels="{ title: 'Updates', showMore: ({ count }) => `Show ${count} more updates` }" />
jsx
<NotificationCenter labels={{ title: 'Updates', showMore: ({ count }) => `Show ${count} more updates` }} />

Using Translations in Your Own Components ​

The trans function returns the current text of a key, with its parameters. You may use it in a custom notification item or in your own Toaster, so its text matches the built-in components:

js
import { trans } from '@inertiaui/notifications-vue'

const name = trans('inbox_item_control', { action: trans('inbox_archive'), title: 'Invoice paid' })
js
import { trans } from '@inertiaui/notifications-react'

const name = trans('inbox_item_control', { action: trans('inbox_archive'), title: 'Invoice paid' })

For a key without a translation, the trans function returns the key itself.

Available Translations ​

Each key starts with the part of the package that uses it: toaster_ and toast_ for the Toaster, error_toast_ for the error toasts, inbox_ for the notification center and the NotificationList, and preferences_ for the NotificationPreferences component.

Toaster ​

KeyDefaultParameters
toaster_labelNotifications
toaster_label_with_hotkey:label (:hotkey)label, hotkey
toaster_hotkey_alt, toaster_hotkey_ctrl, toaster_hotkey_meta, toaster_hotkey_shiftAlt, Ctrl, Meta, Shift
toaster_hotkey_separator+
toast_dismissDismiss: :titletitle
toast_count×:countcount
toast_type_success, toast_type_info, toast_type_warning, toast_type_errorSuccess, Info, Warning, Error
toast_type_default, toast_type_loadingNone

The toaster_label text is the accessible name of the toast region. With a keyboard shortcut, the region uses toaster_label_with_hotkey instead, such as "Notifications (F8)". The toast_count text is the counter of a toast that showed more than once.

Screen readers announce the toast_type_ word before a toast's title, such as "Error: Payment failed". Toasts of the default and loading types announce none. A custom type uses the key with its name, such as toast_type_deployment.

Error Toasts ​

KeyDefault
error_toast_403This action is unauthorized.
error_toast_419, error_toast_419_descriptionThis page has expired. Refresh the page and try again.
error_toast_429, error_toast_429_descriptionToo many requests. Wait a moment and try again.
error_toast_5xx, error_toast_5xx_descriptionSomething went wrong. Try again later.
error_toast_network, error_toast_network_descriptionYou appear to be offline. Check your connection and try again.

These are the title and description of each error toast. An empty description leaves the description out, and you may give the 403 toast one with error_toast_403_description. Toasts for other statuses come from the errorToasts option.

Notification Center ​

KeyDefaultParameters
inbox_titleNotifications
inbox_bellNotifications
inbox_bell_newNotifications, :count newcount, number
inbox_bell_paused:label, pausedlabel
inbox_all, inbox_unread, inbox_snoozed, inbox_archivedAll, Unread, Snoozed, Archived
inbox_mark_all_as_read, inbox_archive_allMark all as read, Archive all
inbox_more_actionsMore actions
inbox_item_control:action: :titleaction, title
inbox_mark_as_read, inbox_mark_as_unreadMark as read, Mark as unread
inbox_archive, inbox_unarchiveArchive, Move to inbox
inbox_snooze, inbox_unsnoozeSnooze, Unsnooze
inbox_mute, inbox_unmute, inbox_mutedMute thread, Unmute thread, Thread muted
inbox_deleteDelete
inbox_selectSelect: :titletitle
inbox_select_all, inbox_selected, inbox_selectionSelect all, :count selected, Selected notificationscount for inbox_selected
inbox_read_selected, inbox_unread_selectedMark selected as read, Mark selected as unread
inbox_snooze_selected, inbox_unsnooze_selectedSnooze selected, Unsnooze selected
inbox_archive_selected, inbox_unarchive_selected, inbox_delete_selectedArchive selected, Move selected to inbox, Delete selected
inbox_clear_selectionClear selection
inbox_show_new:count newcount
inbox_snooze_untilSnooze until
inbox_snoozed_untilSnoozed until :timetime
inbox_snooze_later_today, inbox_snooze_tomorrow, inbox_snooze_next_weekLater today, Tomorrow, Next week
inbox_pausePause notifications
inbox_pause_for, inbox_pause_tomorrowFor :duration, Until tomorrowduration and minutes for inbox_pause_for
inbox_paused_until, inbox_resumeNotifications paused until :time, Resumetime for inbox_paused_until
inbox_show_more, inbox_show_lessShow :count more, Show lesscount
inbox_categories, inbox_all_categoriesCategories, All categories
inbox_unread_stateUnread
inbox_actors_and_other, inbox_actors_and_others:name and :other, :name and :count othersname, other, and count
inbox_empty, inbox_empty_unread, inbox_empty_snoozed, inbox_empty_archivedYou have no notifications. You have no unread notifications. You have no snoozed notifications. You have no archived notifications.
inbox_error, inbox_retryThe notifications could not be loaded. Try again
inbox_loading, inbox_load_moreLoading notifications…, Load more
inbox_view_allView all notifications
inbox_update_failedThe notification could not be updated.
inbox_toast_view, inbox_toast_view_altView, Also in your notifications.
inbox_title_count(:count) :titlecount, number, title
inbox_announcementAnnouncement

The inbox_bell text is the accessible name of the bell, and inbox_bell_new names it while there are new notifications. While notifications are paused, inbox_bell_paused names the bell, with one of the other two as label. Screen readers read inbox_unread_state for an unread notification and inbox_announcement for an announcement.

The tooltip of each button of a notification shows its text, such as inbox_archive. Screen readers read inbox_item_control instead, with that text as action and the notification's title as title, such as "Archive: Invoice paid".

The inbox_pause text names the pause times in the More actions menu. The inbox_pause_for text labels each number of minutes of the pause.presets option, with the duration as the locale writes it, such as "30 minutes" or "2 hours", as duration, and the number itself as minutes. The inbox_paused_until text shows at the top of the panel during a pause, with the end of the pause as time.

The inbox_actors_ texts name the actors of a collapsed notification, with the newest as name. The inbox_show_new text labels the button of new notifications while scrolling, and inbox_title_count is the tab title while notifications are unread.

The inbox_update_failed text is the error toast for a failed read or archive. The inbox_toast_view text labels the action of a notification's toast when the notification has a URL and no actions, and screen readers read inbox_toast_view_alt after the toast. A toast that the server flashes for a notification uses Laravel's translations of View and Also in your notifications. instead.

Preferences ​

KeyDefaultParameters
preferences_titleNotification preferences
preferences_categoryCategory
preferences_toggle:category: :channelcategory, channel
preferences_lockedAlways on
preferences_globalAll notifications
preferences_global_descriptionTurn a channel off for every category, except those that are always on.
preferences_frequencyFrequency
preferences_frequency_label:category: frequencycategory
preferences_frequency_instantInstantly
preferences_frequency_hourlyHourly digest
preferences_frequency_dailyDaily digest
preferences_frequency_weeklyWeekly digest
preferences_push_devicePush notifications on this device
preferences_push_offOff. Turn them on to get notifications on this device, even when the app is closed.
preferences_push_onOn. This device gets the categories you chose for push notifications.
preferences_push_turn_onTurn on for this device
preferences_push_turn_offTurn off
preferences_push_turning_onTurning on…
preferences_push_turning_offTurning off…
preferences_push_blockedNotifications are blocked for this site. Allow them in your browser's site settings to turn on push notifications.
preferences_push_home_screenOn iPhone and iPad, push notifications only work from the Home Screen. Tap Share, choose Add to Home Screen, and open the app from there.
preferences_push_insecurePush notifications need a secure connection. Open this site over HTTPS to turn them on.
preferences_push_braveBrave blocks push notifications until you turn on "Use Google services for push messaging" in its privacy settings. Turn it on, then try again.
preferences_push_failedPush notifications could not be turned on for this device.
preferences_push_failed_offPush notifications could not be turned off for this device.
preferences_push_retryTry again
preferences_push_devicesOther devices with push notifications
preferences_push_device_name:browser on :platformbrowser, platform
preferences_push_device_unknownUnknown browser
preferences_push_device_activeActive :timetime
preferences_push_device_removeRemove
preferences_push_device_remove_labelRemove :devicedevice
preferences_notification_hoursNotification hours
preferences_notification_hours_descriptionOutside these hours, emails wait and notifications arrive without a toast or a sound. Categories that are always on still send.
preferences_notification_hours_startFrom
preferences_notification_hours_endUntil
preferences_notification_hours_dayNotification hours on :dayday
preferences_notification_hours_offNotifications wait all day
preferences_notification_hours_addAdd hours
preferences_notification_hours_add_labelAdd hours on :dayday
preferences_notification_hours_removeRemove
preferences_notification_hours_remove_labelRemove :start to :end on :daystart, end, day
preferences_emptyThere are no notification preferences.
preferences_loadingLoading preferences…
preferences_error, preferences_retryThe preferences could not be loaded. Try again
preferences_save_failedYour preferences could not be saved.
preferences_push_device_remove_failedThe device could not be removed.

The labels of the NotificationPreferences component describe where each text shows, such as title for preferences_title. The preferences_push_ texts show in the push device control and the list of other devices. The preferences_save_failed text is the error toast for a switch that fails to save, and preferences_push_device_remove_failed the one for a device that fails to be removed.