diglin / oro-deepl
Allow to extract non translated strings from OroPlatform applications and translate them through deepl web service. A Deepl developer account is required
Installs: 642
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- deeplcom/deepl-php: 1.4.0
- oro/platform: >=4.2.0 <5.2
This package is auto-updated.
Last update: 2025-01-08 13:33:41 UTC
README
Translation is boring ? Not anymore with the powerful helps of the machine learning tool DeepL. Thanks to this bundle, you can translate all non-translated strings from the OroPlatform database and export them into a YAML or CSV file for reuse.
The translation will take care to not translate strings with such tags: "It could be cool if this {{ won't be translated }} or my dear %hello world% stay safe"
If you have created translation files into your own bundles, they need to be loaded into the database before to proceed translation with Deepl. You must use the command "oro:translation:convert" before.
Special recommendation
Translating via DeepL API costs. So for this reason, if any problem appears while exporting. Do not run again the same command right now. Instead, open the ... TODO (because I have to check exactly how to proceed...)
CSV Export
In the case, a CSV file is exported, the english value is exported also and can be used for human translation or for checking translated values.
Once you did the check of the translation, use the command "diglin:oro:deepl:translate:convert" to convert the CSV into a YAML file located into the translations
folder then it will load the content into your OroPlatform database.
On Production environment, you just need to let the generated files onto the translations
folder, after your deployment, run the command oro:platform:update --force
(do a database backup before to run it).
YAML Export
The generated file can be used one to one to be loaded into your application. OroPlatform can also load it into your database if needed (e.g. to allow backend users to edit those translations).
Same as for the CSV export, on Production environment, you just need to let the generated files onto the translations
folder, after your deployment, run the command oro:platform:update --force
(do a database backup before to run it).
Installation
composer require diglin/oro-deepl
Requirement
- OroPlatform 4.x, 5.0, 5.1 (may work on previous versions but not tested)
Configuration
DeepL API Key is required if you want to translate the strings automatically.
- Please, go to OroPlatform Backoffice, menu
System > Configuration > System Configuration > Integrations > DeepL
- or provide the key via the parameter
deepl-api-key
- or set the key into the
var/deepl-license.key
file.
If no API Key is present, an error message will be displayed but empty translation will still be generated.
Usage examples
Export empty strings of values in CSV to be translated
bin/console --env=prod diglin:oro:deepl:translate:export --format csv --disable-deepl de_DE
Export translation into a CSV file, an english value will be available for translation check
bin/console --env=prod diglin:oro:deepl:translate:export --format csv de_DE
Export translation directly into a YAML file, existing data will be merged but overwritten if duplicate happens. The generated file will have a timestamp
bin/console --env=prod diglin:oro:deepl:translate:export --format yml de_DE
Export translation directly into a YAML file, existing data will be merged but overwritten if duplicate happens. The existing domain translation file (e.g. messages.de_DE.yml) will be overwritten.
bin/console --env=prod diglin:oro:deepl:translate:export --format yml --overwrite de_DE
Translate only messages domain
bin/console --env=prod diglin:oro:deepl:translate:export --domains messages de_DE
Calculate the number of characters will be exported for locale de_DE, useful to estimate DeepL cost
bin/console --env=prod diglin:oro:deepl:translate:export --domains messages,jsmessages,workflows,validators,security --simulate de_DE
Load previously generated CSV file and convert it to YAML, import it into the database and rebuild language cache without frontend interruption
bin/console --env=prod diglin:oro:deepl:translate:convert --rebuild-cache translations/messages.de_DE.csv de_DE
Do you have a tip ?
Well, we admit that diglin:oro:deepl:translate:export
is a long command but at least it describes what it does.
If you prefer, you can use this shortcut instead: d:o:d:t:e
ROADMAP
- Add translation button for backend users in different areas (CMS, products, translation management)-
License
See MIT
Author
- Diglin GmbH
- https://www.diglin.com/
- @diglin_
- Follow me on github!