Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Locales Laravel Package

chinleung/laravel-locales

Add easy locale support to Laravel with simple config and helper functions. Set and get the current locale with locale(), and manage supported locales with locales(), prioritizing app.locales over package config. Supports Laravel 6–13 (versioned).

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Multi-locale feature rollout: Accelerates development of language-switching functionality (e.g., dropdowns, URL prefixes like /es/) by providing a standardized, config-driven approach.
  • Internationalization (i18n) roadmap: Enables phased adoption of multilingual support without over-engineering (e.g., start with UI labels, then expand to content/translations).
  • Build vs. buy: Buy for lightweight, Laravel-native locale management; build only if needing advanced features (e.g., dynamic locale detection, per-field translations).
  • Use cases:
    • Global SaaS platforms targeting multiple regions (e.g., EU, LATAM).
    • E-commerce sites with localized product pages/currencies.
    • Content-heavy apps (blogs, documentation) requiring SEO-friendly URLs (e.g., /blog/es).
    • Admin panels with user-preference-driven language switching.

When to Consider This Package

Adopt if:

  • Your Laravel app needs basic-to-intermediate multilingual support (e.g., language switchers, locale-aware routing).
  • You prioritize simplicity over advanced features (e.g., no need for per-field translations or RTL directionality).
  • Your team lacks bandwidth to build a custom locale system from scratch.
  • You’re using Laravel 9–13 and PHP 8.0+ (check compatibility table).
  • Supported locales are static (defined in config) or change infrequently.

Look elsewhere if:

  • You need dynamic locale detection (e.g., browser/geolocation-based defaults).
  • Your app requires per-field translations (e.g., Eloquent models with translatable attributes) → Use spatie/laravel-translatable.
  • You’re building a high-traffic, low-latency app (e.g., Octane/serverless) and need performance-optimized locale handling.
  • Your team requires enterprise support or security audits (package lacks official channels).
  • You need RTL/LTR directionality or locale-specific formatting (e.g., dates, numbers) → Combine with voku/portable-ascii or Laravel’s built-in tools.
  • Your app uses custom route resolution (e.g., non-standard locale prefixes) that conflict with Laravel’s defaults.

How to Pitch It (Stakeholders)

For Executives: *"This package lets us ship multilingual support fast and cheaply by leveraging Laravel’s built-in tools. Instead of building a custom system (which would take weeks and risk bugs), we’ll use a lightweight, config-driven solution that handles:

  • Language switchers (e.g., dropdowns, flags) in days.
  • SEO-friendly URLs (e.g., /es/blog) with minimal dev work.
  • Consistent locale management across the app via simple helpers like locale('fr').

It’s low-risk (MIT-licensed, Laravel-native) and scalable for our roadmap. We’ll start with core features, then expand if needed. Cost: $0 (open-source)."*

For Engineering: *"This package gives us two key advantages:

  1. Speed: Replaces manual app()->setLocale() calls with concise helpers (locale(), locales()) and a single config file for supported languages.
  2. Flexibility: Works with Laravel’s routing, middleware, and facades out of the box. We can:
    • Add locale-aware routes via middleware (e.g., Route::prefix('{locale}')).
    • Manage supported locales dynamically (e.g., locales(['en', 'fr'])).
    • Extend it later for dynamic locales or integrations with other packages.

Trade-offs:

  • No advanced features (e.g., per-field translations), but we can add those later if needed.
  • Minimal community support, but the code is simple and Laravel-compatible.

Proposal:

  1. Install and configure in 1 day (composer + config publish).
  2. Test with a language switcher and locale-aware routes.
  3. Monitor performance and expand as needed.

Alternatives:

  • Build custom: 2–4 weeks of dev time, higher risk.
  • Other packages: More complex (e.g., spatie/laravel-translatable) or unsupported (e.g., abandoned repos)."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi