Blog Sections Open
Localization in Evolution CMS 3 with Laravel-Style Translations
A practical Evo 3 guide showing how to add Laravel-style localization, route language prefixes, and translation namespaces.
One of the more useful Evo 3 shifts was that multilingual logic no longer had to feel like a collection of unrelated hacks. This gist is important because it shows a Laravel-style localization pattern adapted to Evolution CMS: route a language prefix, expose the locale through config, and register translation namespaces so both PHP code and Blade templates can read the same translation layer.
That does not magically replace every multilingual package, but it gives developers a cleaner mental model for projects that want more explicit control over localization instead of relying only on legacy conventions.
Language-prefix routing in .htaccess
RewriteRule ^([a-z]{2})$ $1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]{2})/(.*)$ index.php?q=$2&lang=$1 [L,QSA]This creates URLs like site.com/en/alias and forwards the language code into the request as lang.
Locale config
<?php
if (isset($_GET['lang'])) {
return $_GET['lang'];
}
return 'az';Once this file exists at /core/custom/config/app/locale.php, the current language becomes available through config('app.locale').
Registering translations in a package
public function boot()
{
\Lang::addNamespace('custom', MODX_BASE_PATH . '/core/custom/packages/main/lang');
}Using translations in PHP and Blade
\Lang::get('custom::custom.translate_1')
@lang('custom::custom.translate_1')Why this pattern matters
- it gives Evo 3 projects a cleaner multilingual foundation based on familiar Laravel concepts
- it helps separate URL language detection from translation storage and rendering
- it works naturally with package-based project structure instead of one-off snippet logic
Source: gist. Related docs: Laravel localization. Related package: bLang. Related video: Evolution CMS 2.0 Lesson: bLang.
Displaying Products in Slides, Four per Group
A practical storefront pattern for showing grouped products in sliders and category tabs on Evolution CMS commerce builds.
AJAX Forms in Evolution CMS 3 with Routing, Validation, Request, and Response
A guide to AJAX form handling in Evolution CMS 3 using Laravel-style routing, validation, request handling, and structured responses.