# Switch the app locale from Vue

> Set the locale from an allow-list. A query string is not a locale until you have checked it.

- URL: https://laravel-vuejs.space/laravel-app-locale-vue
- Author: Anass Ez-zouaine (https://laravel-vuejs.space/author/anass-ez-zouaine)
- Published: 2026-10-11
- Topics: Laravel, VueJs, i18n

People searching “Laravel locale Vue” call `App::setLocale($request->query('locale'))` with no list. The [i18n guide](https://laravel-vuejs.space/laravel-vue-i18n) is the Vue strings. This page is the one line that picks the language for Laravel’s own translator.

> **TL;DR**
>
> -   Set the locale from an allow-list.
> -   A query string is not a locale until you have checked it.
> -   Do not pass the raw query string into `setLocale`.
> -   Do not store the locale only in `localStorage`.
>
> **Who it's for:** Laravel + Vue developers
>
> **Applies to:** Laravel 13 · Vue 3

## The fix

```php
$locale = $request->string('locale')->toString();

if (in_array($locale, ['en', 'fr', 'ar'], true)) {
    $request->user()->update(['locale' => $locale]);
    App::setLocale($locale);
}
```

Share the current locale if the layout needs it. Validation messages then use that language on the next response.

## What to avoid

> **Gotcha**
>
> Do not pass the raw query string into `setLocale`. An unknown locale falls through to odd file lookups. Do not store the locale only in `localStorage`. The server renders the flash and the mail, and it cannot see that key.

## FAQ

**Q: How do I switch the app locale from Vue?**

Set the locale from an allow-list. A query string is not a locale until you have checked it.

**Q: What goes wrong with Laravel locale Vue?**

Many developers call `App::setLocale($request->query('locale'))` with no list. Do not pass the raw query string into `setLocale`.
