Skip to main content

Translations

Every user-facing string — the views, the notification, and the status and error responses (the "we sent a link", "invalid or expired", challenge-failed, and "please wait N seconds" messages) — runs through Laravel's translator under the email-magic-link namespace, so everything follows the application's active locale.

What ships

LocaleLanguage
enEnglish
deGerman
esSpanish
frFrench
itItalian
nlDutch
ptPortuguese
en-GB, en-USRegional English — delegate to en, ready for regional refinement
pt-PTEuropean Portuguese, in the informal tu form
pt-BRBrazilian Portuguese — delegates to pt, the você form

The regional bundles answer to both spellings: the hyphenated form above and the ISO 15897 form Laravel's documentation prescribes (en_GB, en_US, pt_PT, pt_BR). Set app.locale to whichever your application uses.

An application that distinguishes the regional variants renders fully localized screens and emails with no fallback.

Why the identical-looking bundles exist

en-GB, en-US and pt-BR carry no strings of their own today — they are a one-line require of their base bundle, so there is no second copy to keep in step by hand.

They are not simply left out, and the reason is worth knowing before you delete them from a published copy. Laravel falls back to app.fallback_locale, not to the base language: in an application whose fallback is de, a visitor on en-GB with no bundle present is served German. The file is what makes the locale mean what its name says. Give it real content the moment a string actually diverges.

pt-PT is the one that already diverges: European Portuguese addresses the reader as tu (Introduz o teu código) while pt/pt-BR use você (Introduza o seu código).

Translating or rewording

Publish the language files:

php artisan vendor:publish --tag=email-magic-link-lang

That copies the strings to lang/vendor/email-magic-link/{locale}. Add a locale by copying the en directory — for example to sv — and translating the values; the :app and :minutes placeholders are filled in at render time.

One thing on the WireKit screens is not ours to translate

If you serve the WireKit screens, a few strings on them come from WireKit rather than from this package: the alert prefixes a screen reader announces (Success, Error) and the per-box label on the one-time-code field (Digit :position of :total). All three are screen-reader-only, which is why nothing looks wrong — a sighted reader sees a fully translated page while someone tabbing through the code field hears Digit 1 of 8, Digit 2 of 8, in the middle of an otherwise translated sign-in screen.

Seven locales need nothing. WireKit ships de, es, fr, it, nl, pt and pt-BR beside en (German since 2.26.0, the other six since 2.27.0) and registers them at boot, so an application on one of those locales gets these strings translated with no publishing step and no file of its own.

Two details decide whether that reaches you:

  • The locale has to match exactly. Laravel's JSON loader looks for the locale as written, with no fallback to the base language, so de is served and de_DE, de-AT and de-CH are not. On a regional locale, supply the strings yourself as below.
  • Your own file wins per key, not per file. Application-level translations are merged over the package's, so defining one key leaves every other WireKit string at its shipped value. You never lose a bundled locale by adding a file — only by overwriting the keys in it.

For a locale WireKit does not ship — Swedish, say — publish the reference catalog and copy the closest one to your language root:

php artisan vendor:publish --tag=wirekit-lang
cp lang/vendor/wirekit/en.json lang/sv.json

Then translate the values in lang/sv.json. Leave the :position and :total placeholders in place. Do not copy en.json over a locale WireKit already ships — that replaces working translations with English until you have retranslated every key by hand. The shipped set is the list of files in vendor/pushery/wirekit/lang.

The email itself

The notification is a normal Laravel notification. To change more than its wording — its branding, its channels, its layout — extend MagicLinkNotification and point the notification config key at your class. See Extension points.