Download the PHP package alooze/qwertcms-lang without Composer
On this page you can find all versions of the php package alooze/qwertcms-lang. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alooze/qwertcms-lang
More information about alooze/qwertcms-lang
Files in alooze/qwertcms-lang
Package qwertcms-lang
Short Description Database-store language module for QWERT CMS
License MIT
Homepage https://github.com/alooze/
Informations about the package qwertcms-lang
QWERTCMS-LANG
Данная библиотека является модулем для alooze/qwertcms-base. Ее предназначение - дать возможность хранить языковые строки в БД и управлять этими строками через админку.
Обычный способ использования языковых строк при этом не изменяется.
Архитектура
1) миграция lang_data 2) модель LangData 3) trait alooze/QwertCms/Translatable/Translatable 4) функции хелперы в файле Helpers/translate.php 5) роуты для управления языковыми строками в админке routes/qwertcms-lang.php (нужен include в роуты) 6) контроллер для админки LangController 7) шаблоны из views/langs/ 8) настройка в админке 'НАСТРОЙКИ', [ 'text' => 'Языковые строки', 'url' => 'admin/langs', 'icon' => 'cubes',//'braille', 'icon_color' => 'green' ], 9) папка public для копирования в public/vendors/qwertcms-lang
Замечания по реализации
1) Уникальность названий полей в таблице lang_data не отслеживается 2) Сами ключи языков не хранятся в БД, только в конфиге 3) Для сохранения моделей и их переводов необходимо к модели подключить trait Translatable, указать атрибут protected $translatable = ['name']; и использовать один из двух методов lcreate($data, $locale=null, $keyField='id') или lsave($locale=null, $keyField='id')
Install
Via Composer
Описание установки и использования будет сделано позднее
Credits
- alooze
- All Contributors
License
The MIT License (MIT). Please see License File for more information.