r3h6 / form-translator
Provides a backend module and cli for translating forms.
Installs: 9 593
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 5
Open Issues: 5
Type:typo3-cms-extension
Requires
- php: >= 8.1 < 8.4
- softcreatr/jsonpath: ^0.9
- typo3/cms-core: ^12.4 || ^13.4
- typo3/cms-form: ^12.4 || ^13.4
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- ergebnis/composer-normalize: ^2.44
- friendsofphp/php-cs-fixer: ^3.3
- helmich/typo3-typoscript-lint: ^3.1
- michielroos/typo3scan: ^1.7
- mikey179/vfsstream: ^1.6
- phpmd/phpmd: @stable
- phpunit/phpcov: ^9.0 || ^10.0
- saschaegerer/phpstan-typo3: ^1.0
- symfony/translation: ^6.4 || ^7.1
- symfony/yaml: ^6.4 || ^7.1
- typo3/cms-beuser: ^12.4 || ^13.4
- typo3/cms-extensionmanager: ^12.4 || ^13.4
- typo3/cms-filelist: ^12.4 || ^13.4
- typo3/cms-fluid-styled-content: ^12.4 || ^13.4
- typo3/cms-install: ^12.4 || ^13.4
- typo3/cms-lowlevel: ^12.4 || ^13.4
- typo3/coding-standards: ^0.8
- typo3/testing-framework: ^8.0 || ^9.0
Replaces
- typo3-ter/form-translator: 3.0.1
This package is auto-updated.
Last update: 2024-11-18 18:38:53 UTC
README
form_translator
This extension provides a backend module for translating TYPO3 form framework forms and a cli for creating a source xliff file for a given form.
Installation
Either from TYPO3 TER or through composer $ composer req r3h6/form-translator
.
Integration
If you like use machine translation by LibreTranslate you must only configure an api host in the extension configuration. See available mirrors.
How it works
The extensions adds a translation file path to the *.form.yaml file when localize through the backend module.
# example.form.yaml renderingOptions: translation: translationFiles: 99: fileadmin/form_definitions/l10n/example.xlf
Customized validation error messages are translated by overriding the form definition
at runtime using the afterBuildingFinished
hook from the form framework.
Upgrade
From v2 an TYPO3 v12
Rename language files prefixed with a locale like de_DE.locallang.xlf
to the corresponding TYPO3 language de.locallang.xlf
or setup a custom language.
From v2 an TYPO3 v11
No changes required.
Known issues
Transalte to English overrides the original form labels
Scenario: German is used as default language and your form definition labels are in German too.
When you translate a form to English, English will override your original labels even on the German version of your site.
You have following options:
- Create a (duplicated) German translation of the form
- Add the English locale without charset to the extension configuration
typo3LanguageWhitelist
Background: Beginning with v12, TYPO3 uses the locale configured for the site to determine the language.
For English, TYPO3 uses the file named xyz.xlf
, it does not load a file named en.xyz.xlf
, but it does for en_US.xyz.xlf
.
Resources
Develpment
Events
Local setup
Setup libretranslate:
docker run -ti --rm -p 5000:5000 -e LT_LOAD_ONLY='en,de' libretranslate/libretranslate
LibreTranslate host:
http://host.docker.internal:5000/
Contribution
Pull request are welcome!
Please note: I will not include other translation api's than LibreTranslate in this extension.
If you need an other service, you can create your own by implementing TranslationServiceInterface
.