---
title: "Locale & timezone — Auth for Laravel | Roundly"
description: "Negotiate each request’s locale, store the account’s locale and timezone, and send every notification in the account’s language."
url: https://roundly-consulting.com/open-source/docs/auth-for-laravel/locale
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Auth for Laravel](https://roundly-consulting.com/open-source/docs/auth-for-laravel.md)

# Locale & timezone

```php
'locale' => [
    'header' => 'X-Locale',
    'supported' => ['en', 'sk'],         // list<string>|null → [app.locale]
    'store_on_registration' => true,
    'fill_on_login' => true,
    'timezone' => true,
],
```

- Negotiation — the guard’s X-Locale header wins when it names a supported locale; then Accept-Language (q-values, \*, bounded to 20 entries and 1 KB), matched exactly, then by language prefix (sk-SK → sk).
- Storage — locale and timezone are stored on registration and invitation acceptance, filled on login when empty, and changed with PATCH locale; LocaleUpdated fires.
- Notifications — preferredLocale() makes Laravel localise account mail; mail to other addresses (the new or old address, an invitee) carries an explicit locale. An account-exists notice is the address holder’s mail, so it goes in the holder’s preferredLocale(), falling back to the requester’s (email change), the request’s (registration) or the invitation’s locale. The package copy (mail, error and validation messages) ships in English and Slovak; other locales fall back to app.fallback\_locale until you add them under lang/vendor/authentication/<locale>/.
- Timezone — display-only (e.g. the new-device notification’s time); stored times follow the app timezone.

```json
PATCH /users/auth/locale
Authorization: Bearer eyJ…

{ "locale": "sk", "timezone": "Europe/Bratislava" }
```

The authentication.locale middleware applies the account’s locale on your own routes, else the negotiated one:

```php
Route::middleware(['auth:users', 'authentication.guard:users', 'authentication.locale'])
    ->group(fn () => Route::get('/dashboard', Dashboard::class));
```

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/auth-for-laravel.md)
