Download the PHP package samosadlaker/statamic-langtag without Composer
On this page you can find all versions of the php package samosadlaker/statamic-langtag. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download samosadlaker/statamic-langtag
More information about samosadlaker/statamic-langtag
Files in samosadlaker/statamic-langtag
Package statamic-langtag
Short Description Statamic LangTag addon
License MIT
Homepage https://github.com/SamoSadlaker/statamic-langtag
Informations about the package statamic-langtag
Statamic Langtag
Statamic Langtag is a Statamic CMS addon that simplifies multi-language content handling. It provides a custom tag for managing locale-specific content blocks and routes to switch between supported languages. This addon is especially useful for Statamic sites with multiple locales, helping you easily display content in different languages based on user selection or session.
Requirements
- Statamic 5.x or 6.x
- Laravel 11 (Statamic 5) or 12 (Statamic 6)
- PHP 8.1+ (8.3+ when using Statamic 6)
Features
- Custom Statamic tag (
{{ lang_tag }}and alias{{ lt }}) for rendering language-specific content - Configuration for default and supported locales (e.g., 'sk', 'en')
- Web route for switching locales via URL (
/lang/{locale}) - Automatically sets and remembers the user's locale in the session
- Easy integration with Statamic templates
Installation
Install via Composer:
Configuration
Publish the config file to customize locales:
Edit config/statamic/langtag.php:
Usage
Switch Locale
Navigate to /lang/{locale} to switch to a supported locale. For example: /lang/en or /lang/sk.
The selected locale is stored in the session and used as the application locale.
Template Tag
Use in your Antlers templates:
Using antlers variable
This will display the string based on the current locale, using 'default' if no match.
Check locale
Conditions for checking current locale
Get current locale
Returns the current locale
For example: sk or en.
Alias
You can also use the alias:
Fix locale
Support
Found a bug or have a feature request? Please open an issue on GitHub.
License
MIT License. See LICENSE for details.