What is Locale?

A locale is an identifier for a set of language and regional conventions. It typically combines a language code with a region code, as in en_US or pt_BR, and can include a script, as in zh_Hant. The locale determines which translations load and how dates, numbers, currencies, and sorted lists are rendered.

Language and locale are not the same thing. Portuguese from Portugal and Portuguese from Brazil share a language code but differ in vocabulary, spelling, and formats, so serious localization often targets locales rather than bare languages. Whether you need that granularity depends on your audience; many apps start with plain language codes and split by region later.

Laravel stores the active locale on the application container. You set it per request, usually from a URL segment, the session, or a user preference, and every call to __() and the intl formatters resolves against it from then on.

use Illuminate\Support\Facades\App;

// Set the active locale for this request
App::setLocale('pt_BR');

App::currentLocale();    // 'pt_BR'
App::isLocale('pt_BR');  // true

Put the theory to work

LangSyncer manages your Laravel translations live: import lang files, translate with AI and publish without a deploy.

We use cookies to improve your experience and analyze site traffic. Cookie Policy

Cookie Preferences

Essential

Required for the site to work

Analytics

Help us improve the site

Marketing

Personalized ads and content