You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/backend/upgrading/version-specific-migration/upgrade-to-62.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,3 +81,24 @@ This is because we keep a mapping from the old to the new location.
81
81
For example, `plone.locking` registers that `plone.locking.browser.info.pt` has a new location: `plone.app.layout.viewlets.locking.pt`.
82
82
You should rename your override to the new location if you no longer need compatibility with Plone 6.1 or earlier.
83
83
```
84
+
85
+
86
+
## Replaced Google Translate integration with generic translation integration
87
+
88
+
`plone.app.multilingual` had an integration to use only Google Translate to translate the content in the `babel_view`, where the content in two languages is shown side-by-side.
89
+
This integration was limited to only Google Translate.
90
+
In Plone 6.2, this integration has been replaced with a generic translation service integration hook.
91
+
92
+
[`collective.translators`](https://github.com/collective/collective.translators) provides some implementations for that hook, supporting AWS, Deepl, Deepseek, Google Translate, Libre Translate, and Ollama.
93
+
It can be extended to support more translation providers.
94
+
95
+
It is not mandatory to use `collective.translator`.
96
+
Any developer can write the integration with the tool of their choice.
97
+
98
+
See the {doc}`/i18n-l10n/use-an-external-translation-service` chapter for details.
99
+
100
+
To achieve that integration, the previously existing `gtranslation_service` browser view has been removed from `plone.app.multilingual`.
101
+
102
+
Due to not needing it anymore, the `plone.google_translation_key` registry entry has been removed, and it will be removed when performing the upgrade step to Plone 6.2.
103
+
104
+
The `babel_view` has been modified to call a new REST API endpoint instead of the old `gtranslation_service` browser view.
Copy file name to clipboardExpand all lines: docs/i18n-l10n/use-an-external-translation-service.md
+30-76Lines changed: 30 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,88 +14,42 @@ myst:
14
14
When translating content items in Plone, you can connect to an external translation service to translate your content.
15
15
16
16
17
-
## Using Google Cloud Translation API
17
+
The `plone.app.multilingual` product that turns Plone into a multilingual content site supports a pluggable way to hook any translation service into Plone.
18
18
19
-
The `plone.app.multilingual` product that turns Plone into a multilingual-content site supports [Google Cloud Translation API](https://docs.cloud.google.com/translate/docs/reference/rest), which allows the content editor to use its translations.
19
+
To do so, one has to implement a utility that implements an `IExternalTranslationService` interface.
20
20
21
-
To use this service as a site administrator, you need to create a project in Google Cloud, enable the Cloud Translation API, and create an API key under the Credentials of the Google Cloud Console.
22
-
You should enter this API key in the {guilabel}`Multilingual Settings` control panel in Plone.
21
+
This utility class must implement the `IExternalTranslationService` interface from `plone.app.multilingual.interfaces` and it should provide at least these methods and an attribute:
23
22
24
-
After doing so, as a content editor, when you edit a translation of a given content page, an icon will display next to the original content.
25
-
When you click this icon, it invokes the Google Cloud Translation API, and the translation obtained through the service will be entered automatically in the corresponding field.
23
+
`is_available()`
24
+
: Returns `True` if the service is enabled and ready.
26
25
27
-
```{note}
28
-
The usage of Google Cloud Translation API may create extra cost for the site administrator.
29
-
See [Cloud Translation pricing](https://cloud.google.com/translate/pricing) for details.
30
-
```
26
+
`available_languages()`
27
+
: Returns a list of supported language codes or pairs that can be used (source, target).
: Performs the translation and returns the translated text.
32
31
33
-
## Using other translation services
34
-
35
-
If you want to use another service beside Google Cloud Translation API, you will need to override the view that calls Google Cloud Translation API.
36
-
37
-
To do so, `plone.app.multilingual` registers a view called `gtranslation_service`.
38
-
Its code is in [`plone.app.multilingual.brwoser.translate.gtranslation_service_dexterity`](https://github.com/plone/plone.app.multilingual/blob/7aedd0ab71d3edf5d1fb4cb86b9f611d428ed76b/src/plone/app/multilingual/browser/translate.py#L52).
39
-
This view gets three parameters:
40
-
41
-
`context_uid`
42
-
: The UID of the object to be translated.
43
-
44
-
`field`
45
-
: The name of the field of the object that needs to be translated.
46
-
This view's job is to extract the value of that field from the object.
47
-
48
-
`lang_source`
49
-
: The source language code.
50
-
51
-
The first part of the view—that which gets the object and the field content to be translated—can be copied from the original code.
52
-
You need to write only the call to the translation service.
53
-
The required code would be something like the following example:
: The order in which this utility will be executed.
34
+
This way, one can prioritize some services over others with given conditions.
35
+
36
+
After doing so, as a content editor, when you edit a translation of a given content page, a translate icon <imgalt="Translate icon"src="../_static/translate.svg"class="inline"> will display next to the original content.
37
+
38
+
When you click this icon, it will invoke the translation utility, and the translation obtained through the service will be entered automatically in the corresponding field.
39
+
40
+
Plone does not implement this interface by itself in any of its utilities.
41
+
42
+
You'll need to use an external package that offers this service as described in {ref}`pre-configured-services-label`, or create your own utility.
43
+
44
+
(pre-configured-services-label)=
45
+
46
+
## Using the translation service with pre-configured services
47
+
48
+
To use some external tools, the Plone community has implemented a package called [`collective.translators`](https://github.com/collective/collective.translators) that implements this functionality for AWS, Deepl, Deepseek, Google Translate, Libre Translate, and Ollama.
49
+
50
+
Each of those services provides a control panel to tweak the configuration, including API keys, languages, service endpoints, and other configuration items.
96
51
97
52
```{note}
98
-
Due to the way that the Google Translate integration is built in `plone.app.multilingual`, you will need to enter something in the {guilabel}`Google Translate API Key` field in the {guilabel}`Multilingual Settings`
99
-
control panel of your site.
100
-
It doesn't need to be a valid Google Translate API Key; it can be a random string.
53
+
The usage of some of those services may create extra cost for the site administrator.
54
+
Check the terms of use of each of the tools for details.
0 commit comments