tastyigniter / ti-ext-translate
Allows multilingual websites with TastyIgniter, making it easy to translate menu items.
Fund package maintenance!
tastyigniter
Open Collective
Installs: 30
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 2
Open Issues: 3
Type:tastyigniter-extension
Requires
- tastyigniter/core: ^v4.0@beta
Requires (Dev)
- larastan/larastan: ^2.4.0
- laravel/pint: ^1.2
- pestphp/pest-plugin-laravel: ^2.0
- sampoyigi/testbench: ^1.0
This package is auto-updated.
Last update: 2024-12-11 23:51:06 UTC
README
Language Picker Component
Using the LocalePicker component a visitor can choose their preferred language. This component shows a simple dropdown, which will change the language of the page depending on the selection.
Add the Language Picker
component to your layout or page
--- title: 'Home' permalink: / '[localePicker]': --- @component('localePicker')
If the text on the page is translated, it will appear as whatever language the user selects. The dropdown is very simple and customisable:
[...] --- <p> Switch language to: <a href="#" data-request="localePicker::onSwitchLocale" data-request-data="locale: 'en'">English</a>, <a href="#" data-request="localePicker::onSwitchLocale" data-request-data="locale: 'es'">Spanish</a> </p>
Model translation
Models can have their attributes translated by using the Igniter\Translate\Actions\TranslatableModel
action and
specifying which attributes to translate in the class.
class Category { public $implement = [\Igniter\Translate\Actions\TranslatableModel::class]; public function translatable() { return ['name']; } }