Table of Contents
Text translation
If you run several language versions of your site, SCJ can automatically translate gallery and category text through third-party services (Google or DeepL) or your own service.
Configuration
Open Rotation → Settings → Translators.
- Select an adapter: Google, DeepL or Custom.
- Enter the service's key in API key.
- Select the source language. Auto asks the service to detect it.
The defaults are Custom and English (en). Custom is an example for building your own translation service.
Google and DeepL use your accounts with those providers. Sign up with the provider to obtain your free API key.
Translating an individual field
Text fields have a translation icon beside them. SCJ translates the current text in that same field, including unsaved edits, into the selected site's language.
The result appears in the same field. Use the form's normal Save button to save it.
Existing and new galleries
For existing galleries, select Fields to translate under Translators and save the settings. Then open Rotation → Settings → Multilingual → Existing languages and use Translate for the required language.
Bulk translation reads the source site's text and overwrites the selected fields on the language site.
For categories, use AutoTranslate All on the categories page. After confirmation, it overwrites the translatable fields of all categories for the language sites.
For new galleries, enable Rotation → Settings → Grabber Settings → Translate to Existing lngs. It is off by default. After a successful initial grab, SCJ translates missing language fields according to Fields to translate. Explicitly supplied nonempty translations are preserved; a regrab does not trigger this translation.
Building your own service (Custom)
The translation example is in includes/libs/translators/Custom.php.
The example does not perform real translation. It immediately returns the original text with a language prefix: for example, Hello world becomes [de] Hello world. It sends no HTTP request.
The same file contains a commented service request: a POST with JSON fields text, source and target, and a key in the X-Api-Key header. For real translation, call a translation service: set its URL and replace the demonstration return with the API call, adapting authentication and response parsing to that service.
To try the example using a translation icon, save demo-key in the Custom settings. The shared settings require a nonempty key, although the local example does not use it. Use your service's key for real translation.
