Laravel theorytheory 0/50 · 0%
Fundamentals · medium

33. Localisation

Supporting multiple languages.

Laravel stores translation strings in lang/{locale}/ files (or JSON files for short-key translations), retrieved with the __() helper or @lang Blade directive. The current locale is set via App::setLocale() or middleware, and pluralization is handled with trans_choice(). Validation messages and error strings can also be localized per language.

Check your understanding

  1. 1. Which helper retrieves a translated string?

  2. 2. Which function handles pluralized translations?