Works only on PHP 7.3+.
See projects dogtrace (old admin), dogtracegps (new admin)
dogtrace commits a1f65aba, 73373a16, b1f5ad60 and cf3b45a0
dogtracegps commits 9c92d631 and 4676f5cc
Copy
- Directory
app/Utils/DeepL - JavaScript files
- SCSS files
- check that there is an incredible select in the admin
- config.neon (about 4 lines)
Adding to the presenters::
- BasePresenters (ZeroAdmin and Admin)
- MenuPresenter
- NastaveniPresenter
- ProductPresenter
- TranslationPresenter
Edit templates:
- @layout.latte in Admin
- default.latte in Zeroadmin Translations
- edit.latte Product in Admin
- item.latte Menu in Admin
- mutace.latte Nastaveni in Admin
- prave_menu.latte Admin Partials
Using composer install deeplcom/deepl-php:composer require deeplcom/deepl-php
Add translations
INSERT INTO `settings_config` (`id`, `name`, `value`, `hidden`, `type`, `note`, `visible`) VALUES
('DEEPL_API_KEY', 'API klíč pro DeepL překladač', '', 0, 'input', '', 0),
('TRANSLATIONS_SOURCE_LANGUAGE', 'ID zdrojového jazyku pro překlady', '1', 0, 'input', '', 0),
('MENUITEM_SUPPLEMENTS_TO_TRANSLATE', 'Supplementy menuitemu, které se přeloží při DeepL překladu', '1;text\n9;html', 0, 'textarea', 'Každý řádek obsahuje dvojici: <supplement_id> ; text / html', 0),
('PRODUCT_SUPPLEMENTS_TO_TRANSLATE', 'Supplementy produktu, které se přeloží při DeepL překladu', '26;text', 0, 'textarea', 'Každý řádek obsahuje dvojici: <supplement_id> ; text / html', 0);
Add the necessary to the compilation webpack.mix.js
And we will test with our own API key from DeepL (especially the translation of the product and menuitem, that's where most problems occur)
What mistakes to watch out for (every website is a bit different, so there can be problems even if everything is copied correctly):
- It's linked to the product edit and menuitem functions, which are really messy functions, so you may need to add some sort of field to what is sent to those functions.
- If it will be copied to another version of PHP (as it was for example the first time from ez 7.4 to 8.1) it may happen that some internal functions will return for example null instead of false. This happened for example with nette databases.
- This extension uses strict types and most admins are not strict at all, so it can happen that '5' is sent to the function instead of int and a problem occurs.
PHP7.4 sites:
- Nábytek polák: task ID: 10355424
- Zámecké návrší: task ID: 4870478