Skip to content

Commit 19cc135

Browse files
committed
Clean up formatting of translating-content.md and add Glossary terms.
1 parent 4d44002 commit 19cc135

File tree

2 files changed

+114
-40
lines changed

2 files changed

+114
-40
lines changed

docs/glossary.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,15 @@ gettext
397397
UNIX standard software translation tool.
398398
See https://www.gnu.org/software/gettext/.
399399
400+
LRF
401+
Language Root Folder
402+
A content-type that contains the translated content for a specified language.
403+
For example, an LRF located at your site root for English would be `www.domain.com/en`, where `en` represents the LRF.
404+
405+
LIF
406+
Language Independent Folder
407+
A folder containing static assets, such as images and files, for a given language.
408+
400409
PO file
401410
`.po`
402411
Portable Object (PO) file.

docs/i18n-l10n/translating-content.md

Lines changed: 105 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,76 +10,126 @@ html_meta:
1010

1111
# Translating content
1212

13-
```{admonition} Description
14-
Translating content items in Plone, creating translations programmatically, and working with translators.
15-
```
16-
1713
```{note}
1814
This chapter concerns only _user-generated content_ translations.
1915
20-
For *code-level* translations of text strings, see {doc}`translating-text-strings`.
16+
For _code-level_ translations of text strings, see {doc}`translating-text-strings`.
2117
```
2218

23-
## Introduction
24-
25-
To have content translation in Plone you need to activate the `plone.app.multilingual` addon which be installed by default in your Plone installation.
19+
To have content translation in Plone you need to activate the `plone.app.multilingual` add-on.
20+
This add-on is installed by default in your Plone site.
2621

27-
```{note}
28-
This multilingual tool makes several assumptions on your content and you as a user have to live with them. Working *against the system* will be hard because Plone will want to continue working as it is expected to work and reconfiguring it in some other way is a hard work. You are warned :wink: !
22+
```{warning}
23+
This multilingual tool makes several assumptions about your content.
24+
It is recommended to work with these assumptions, not against them.
25+
You may choose to work against these assumptions, but be warned that along this path, "here be dragons".
2926
```
3027

28+
29+
(translating-content-configure-languages-label)=
30+
3131
## Configure languages in your site
3232

33-
As a first step, you will need to go to the `@@language-controlpanel` of your Plone site and configure which languages will be available for your site.
33+
Start by visiting the `@@language-controlpanel` of your Plone site.
34+
Configure which languages will be available for your site.
3435

35-
After selecting the langauges and saving the form, Plone will setup the multilingual configuration for you. This means that will do the following tasks:
36+
After selecting the languages and saving the form, Plone will initialize the multilingual configuration for you.
37+
It will perform the following tasks:
3638

37-
- Create one folder per language selected in the root of the site. If you have selected English and French as available languages, it will create the `en` and `fr` folders. Those folders are of an specific content-type called Language Root Folders (LRF for short). Moreover these LRFs are marked as `INavigationRoot` objects, which means that all search, navigation and catalog queries will be automatically restricted to the content inside them, easing the automatic menu building and search.
39+
- Create one folder per language selected in the root of the site.
40+
If you selected English and French as available languages, it will create the `en` and `fr` folders.
41+
Those folders are a specific content type called {term}`Language Root Folder`s (LRFs).
42+
Moreover, these LRFs are marked as `INavigationRoot` objects.
43+
That means all search, navigation, and catalog queries will be automatically restricted to the content inside them, making it easier to automatically build menus and search within a site's specified language.
3844

39-
- Plone will change the default layout of the Plone Site object to be the `@@language-switcher` view. This view will handle the language negotiation between the end-user and Plone when the user lands in the home page of your site.
45+
- Plone will change the default layout of the Plone Site object to be the `@@language-switcher` view.
46+
This view will handle the language negotiation between the end user and Plone when the user lands in the home page of your site.
4047

41-
Plone and plone.app.multilingual will always assume that all your multilingual content lives inside those Language Root Folders, and no other thing should be outside them.
48+
Plone and `plone.app.multilingual` will always assume that all your multilingual content lives inside those Language Root Folders.
49+
No other thing should be outside them.
50+
51+
52+
(translating-content-translating-your-content-label)=
4253

4354
## Translate your content
4455

4556
After enabling multiple languages in your site, the Plone toolbar will provide menu items to translate your content to the available languages.
4657

47-
Be careful, Plone will not translate the content for you, it will "only" create the content in the other language folder and both contents will be linked to be translations.
58+
Be careful!
59+
Plone will not translate the content for you.
60+
It will only create the content in the other language folders, and both LRFs' contents will be linked to the translations.
61+
62+
Plone does not use any third party tools to automatically translate content.
63+
If needed, you will need to develop such connector tools and hook into a content creation process.
4864

49-
Plone does not use any thirdparty tools to automatically translate content. If needed, you will need to develop such connector tools and hook into content creation process.
65+
66+
(translating-content-language-independent-content)=
5067

5168
## Language independent content
5269

53-
In some cases it is justified to have so called "language independent content", which means content that you need to be available in several languages, usually this content is made of Files or Images. Plone provides the so called Language Independent Folders (LIF for short), that are automatically created when enabling languages in your site.
70+
In some cases it is justified to have "language independent content".
71+
This means content that you need to be available in several languages, such as files or images.
72+
Plone provides the {term}`Language Independent Folder`s (LIF), that are automatically created when enabling languages in your site.
5473

55-
In the root of your language folder you will find an 'assets' folder (if you have configured the English site is called `Assets`, in Spanish `Media`, it can have different names in different languages) where you can store those language independent contents. Plone will take care of showing you any content uploaded to those LIFs in all languages. LIFs are internally special Folders which are linked into all languages and share the internal structure that saves content objects.
74+
In the root of your language folder you will find a folder containing static assets.
75+
If you have configured the English site, this folder is called `Assets`.
76+
In Spanish, it is called `Media`.
77+
It can have different names in different languages.
78+
You can store assets in those language independent folders.
79+
Plone will take care of showing you any content uploaded to those LIFs in all languages.
80+
LIFs are internally special folders that are linked to all languages and share the internal structure that saves content objects.
5681

5782
```{note}
58-
It is not possible to have more than one LIF per language. Plone will not correctly work if you try to manually add more LIFs. That's the reason behind not being able to add more LIFs by default.
83+
It is not possible to have more than one LIF per language.
84+
Plone will not correctly work if you try to manually add more LIFs.
85+
That's the reason behind not being able to add more LIFs by default.
5986
```
6087

88+
89+
(translating-content-language-selector-label)=
90+
6191
## Language selector
6292

63-
After enabling several languages in your Plone site, Plone will show a language selector widget in the top of your site. This widget will link the actual page the user is browsing with its translated counterparts.
93+
After enabling several languages in your Plone site, Plone will show a language selector widget in the top of your site.
94+
This widget will link the actual page the user is browsing with its translated counterparts.
6495

65-
The language controlpanel provides several ways to configure this widget:
96+
The language control panel provides several ways to configure this widget:
6697

67-
- Show language flags: it is quite common to use flags to identify languages and enabling this option will do it for you. Anyway this is not considered best practice because country flags do not represent language. Why should one use Spanish flag to identify the Spanish language when browsing a south-american english-spanish bilingual site? That's why usually it is recommended to disable the "Show language flags" option.
98+
- {guilabel}`General > Show language flags`.
99+
It is common to use flags to identify languages.
100+
Enabling this option will do it for you.
101+
However, this is not considered a best practice because country flags do not necessarily represent a language.
102+
Why should one use a Spanish flag to identify the Spanish language when browsing a South American, English-Spanish bilingual site?
103+
It is recommended to disable the {guilabel}`Show language flags` option.
68104

69-
- Policy used to determine how the lookup for the available translation will be made. What to do when a given content is not translated to some other language? Which link should Plone show if any? Plone provides 2 policies to configure such scenario.
105+
- {guilabel}`Multilingual > The policy used to determine how the lookup for available translations will be made by the language selector.`
106+
What to do when a given content is not translated to another language?
107+
Which link should Plone show, if any?
108+
Plone provides two policy options to choose from to configure such scenarios.
70109

71-
- Search for closes translation in parent's content chain: this will send the user to the selected language and will try to find a translated parent of the actual content. This is the default policy.
110+
- {guilabel}`Search for closest translation in parent's content chain.`
111+
This option will send the user to the selected language, and will try to find a translated parent of the actual content.
112+
This is the default policy.
72113

73-
- Show "no translations for this content": this will sent the user to the selected language but it will present a "No translation for this content" page, allowing the user to go to some other language, or keep browsing that site but informing that there is no such content in that language.
114+
- {guilabel}`Show user dialog with information about the available translations.`
115+
This option will send the user to the selected language, but it will present a "No translation for this content" page, allowing the user to go to some other language or keep browsing that site, while informing the user that there is no such content in that language.
74116

117+
```{todo}
118+
This option appears to not work as documented in the [Plone 6 Classic UI demo](https://6-classic.demo.plone.org/@@language-controlpanel).
119+
```
120+
121+
122+
(translating-content-marking-objects-as-translatables-label)=
75123
76124
### Marking objects as translatables
77125
78126
79127
#### Dexterity
80128
81-
Users should mark a dexterity content type as translatable by assigning a multilingual behavior to the definition of the content type either via file system, supermodel, or through the web.
129+
Users should mark a Dexterity content type as translatable by assigning a multilingual behavior to the definition of the content type either via file system, supermodel, or through the web.
130+
82131
132+
(translating-content-marking-fields-as-language-independent-label)=
83133
84134
### Marking fields as language independent
85135
@@ -114,12 +164,18 @@ alsoProvides(ISchema['myField'], ILanguageIndependentField)
114164

115165
##### Through the web
116166

117-
Via the content type definition in the {guilabel}`Dexterity Content Types` control panel.
167+
Via the content type definition in the {guilabel}`Content Types` control panel.
168+
169+
```{versionchanged} 6.0
170+
Changed the name from "Dexterity Content Types" to just "Content Types".
171+
```
172+
118173

174+
(translating-content-language-getset-via-unified-adapter-label)=
119175

120176
### Language get/set via a unified adapter
121177

122-
In order to access and modify the language of a content type regardless of the type there is an interface/adapter, `plone.app.multilingual.interfaces.ILanguage`.
178+
In order to access and modify the language of a content type, regardless of whether the type is an interface or adapter, we use `plone.app.multilingual.interfaces.ILanguage`.
123179

124180
In your code, you can use the following.
125181

@@ -135,59 +191,68 @@ language = ILanguage(context).set_language('ca')
135191
```
136192

137193

138-
### ITranslationManager adapter
194+
(translating-content-itranslationmanager-adapter-label)=
139195

140-
The most interesting adapter that `plone.app.multilingual` provides is `plone.app.multilingual.interfaces.ITranslationManager`.
196+
### `ITranslationManager` adapter
141197

198+
The most interesting adapter that `plone.app.multilingual` provides is `plone.app.multilingual.interfaces.ITranslationManager`.
142199
It adapts any `ITranslatable` object to provide convenience methods to manage the translations for that object.
143200

144201

202+
(translating-content-add-a-translation-label)=
203+
145204
#### Add a translation
146205

147-
Given an object `obj`, and we want to translate it to the Catalan language ('ca'):
206+
Given an object `obj`, translate it to the Catalan language (`ca`):
148207

149208
```python
150209
from plone.app.multilingual.interfaces import ITranslationManager
151210
ITranslationManager(obj).add_translation('ca')
152211
```
153212

154213

155-
#### Register a translation for an already existing content
214+
(translating-content-register-a-translation-for-existing-content-label)=
156215

157-
Given an object `obj`, and we want to add `obj2` as a translation for the Catalan language ('ca'):
216+
#### Register a translation for existing content
217+
218+
Given an object `obj`, and we want to add `obj2` as a translation for the Catalan language (`ca`):
158219

159220
```python
160221
ITranslationManager(obj).register_translation('ca', obj2)
161222
```
162223

163224

225+
(translating-content-get-translations-for-an-object-label)=
226+
164227
#### Get translations for an object
165228

166-
Given an object `obj`:
229+
Given an object `obj`, get all the translated objects (including the context):
167230

168231
```python
169232
ITranslationManager(obj).get_translations()
170233
```
171234

172-
and if we want a concrete translation:
235+
To get a specific translation, such as Catalan (`ca`):
173236

174237
```python
175238
ITranslationManager(obj).get_translation('ca')
176239
```
177240

178241

179-
#### Check if an object has translations
242+
(translating-content-check-an-object-for-translations-label)=
243+
244+
#### Check an object for translations
180245

181-
Given an object `obj`:
246+
Given an object `obj`, get a list of all of its translated languages:
182247

183248
```python
184249
ITranslationManager(obj).get_translated_languages()
185250
```
186251

187-
or:
252+
Or to check for a specific translated language:
188253

189254
```python
190255
ITranslationManager(obj).has_translation('ca')
191256
```
192257

193-
For more information, see https://github.com/plone/plone.app.multilingual/blob/ee81a3015ac3f26505e82638030a95d786a1a444/src/plone/app/multilingual/interfaces.py#L76.
258+
For all available methods, see the source code of the [`plone.app.multilingual.interfaces.ITranslationManager` class](https://github.com/plone/plone.app.multilingual/blob/5363b90c8adf90eb9bd6aeaebf6fe6b03a4e866f/src/plone/app/multilingual/interfaces.py#L75).

0 commit comments

Comments
 (0)