Skip to content

Commit f81ab21

Browse files
committed
Create skeleton framework for internationalization and localization.
Keep original files around for now as a reference. Their content might be relevant or out of date. Who knows?
1 parent 9ecd4f0 commit f81ab21

File tree

7 files changed

+290
-5
lines changed

7 files changed

+290
-5
lines changed

docs/glossary.md

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,24 +357,70 @@ elementEditor
357357
358358
i18n
359359
internationalization
360+
Internationalization
361+
Internationalization is the process of preparing an application for displaying content in languages and formats specifically to the audience.
362+
Developers and template authors usually internationalize the application.
360363
"i18n" is shorthand for "internationalization" (the letter "I", 18 letters, the letter "N").
361-
It refers to the process of preparing a program so that it can be used in multiple languages without further altering the source code.
362-
Plone is fully internationalized.
364+
Plone is fully internationalized.
365+
366+
```{seealso}
367+
{term}`localization`
368+
```
369+
370+
l10n
371+
localization
372+
Localization
373+
Localization is the process of writing the translations of text and local formats for an application that has already been internationalized.
374+
Formats include dates, times, numbers, time zones, and currency.
375+
Translators usually localize the application.
376+
"l10n" is shorthand for "localization" (the letter "L", 10 letters, the letter "N").
377+
Plone is fully localized.
378+
379+
```{seealso}
380+
{term}`internationalization`
381+
```
382+
383+
locale
384+
A locale is an identifier, such as a {term}`language tag`, for a specific set of cultural preferences for some country, together with all associated translations targeted to the same native language.
385+
386+
language tag
387+
A language tag is a string used as an identifier for a language.
388+
A language tag may have one or more subtags.
389+
The basic form of a language tag is `LANGUAGE-[SUBTAG]`.
390+
391+
```{seealso}
392+
- W3C article [Language tags in HTML and XML](https://www.w3.org/International/articles/language-tags/)
393+
- W3C Working Draft [Language Tags and Locale Identifiers for the World Wide Web](https://www.w3.org/TR/ltli/)
394+
```
363395
364396
gettext
365397
UNIX standard software translation tool.
366398
See https://www.gnu.org/software/gettext/.
367399
368-
.po
369-
The file format used by the gettext translation system.
400+
PO file
401+
`.po`
402+
Portable Object (PO) file.
403+
The file format used by the {term}`gettext` translation system.
370404
See https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/PO-Files.html.
371405
406+
PO template file
407+
`.pot`
408+
Portable Object (PO) template file, not yet oriented towards any particular language.
409+
410+
MO file
411+
`.mo`
412+
Machine Object file.
413+
The binary message file compiled from the {term}`.po` message file.
414+
372415
i18ndude
373416
Support tool to create and update message catalogs from instrumented source code.
374417
375-
manual .po entries
418+
manual `.po` entries
376419
Entries which cannot be detected by an automatic code scan.
377420
421+
react-intl
422+
A library that is part of [Format.JS](https://formatjs.io/docs/getting-started/installation) which helps developers set up their applications for internationalization.
423+
378424
WSGI
379425
The Web Server Gateway Interface (WSGI, pronounced _WIZ-ghee_) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language.
380426
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
html_meta:
3+
"description": "How to contribute to the Plone translations."
4+
"property=og:description": "How to contribute to the Plone translations."
5+
"property=og:title": "Contributing Plone Core Translations"
6+
"keywords": "Plone, Internationalization, i18n, language, translation, localization"
7+
---
8+
9+
(contributing-plone-core-translations-label)=
10+
11+
# Contributing Plone Core Translations
12+
13+
```{admonition} Description
14+
How to contribute to the Plone translations.
15+
```
16+
17+
18+
## Introduction
19+

docs/i18n-l10n/index.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
---
2+
html_meta:
3+
"description": "Internationalization (i18n) and localization (l10n) in Plone 6"
4+
"property=og:description": "Internationalization (i18n) and localization (l10n) in Plone 6"
5+
"property=og:title": "Internationalization (i18n)"
6+
"keywords": "Plone, Internationalization, i18n, language, translation, localization"
7+
---
8+
9+
(i18n-l10n-label)=
10+
11+
# Internationalization and Localization
12+
13+
{term}`Internationalization` is the process of preparing an application for displaying content in languages and formats specifically to the audience.
14+
Developers and template authors usually internationalize the application.
15+
"i18n" is shorthand for "internationalization" (the letter "I", a run of 18 letters, the letter "N").
16+
17+
{term}`Localization` is the process of writing the translations of text and local formats for an application that has already been internationalized.
18+
Formats include dates, times, numbers, time zones, units of measure, and currency.
19+
Translators usually localize the application.
20+
"l10n" is shorthand for "localization" (the letter "L", a run of 10 letters, the letter "N").
21+
22+
Plone fully supports internationalization and localization.
23+
24+
```{seealso}
25+
Wikipedia article [Internationalization and localization](https://en.wikipedia.org/wiki/Internationalization_and_localization)
26+
```
27+
28+
29+
(i18n-l10n-code-versus-content-label)=
30+
31+
## Code versus content
32+
33+
We categorize the things that we want to internationalize and localize in a Plone application into two groups:
34+
35+
1. **Code-level elements.**
36+
This includes translations of the user interface elements' text strings and localization.
37+
The tools used in this group include {term}`gettext`, Plone and Zope {term}`i18n` facilities, and {term}`react-intl`.
38+
See the chapter {doc}`translating-text-strings`.
39+
2. **User-generated content.**
40+
For translating user-generated content, Plone uses the package [`plone.app.multilingual`](https://pypi.org/project/plone.app.multilingual/).
41+
See the chapter {doc}`translating-content`.
42+
43+
44+
(i18n-l10n-common-concepts-label)=
45+
46+
## Common concepts
47+
48+
When you internationalize and localize a Plone application, there are some common concepts used throughout these processes.
49+
50+
51+
(i18n-l10n-terms-label)=
52+
53+
### Terms
54+
55+
The following terms are used in this documentation.
56+
57+
locale
58+
: A locale is an identifier, such as a {term}`language tag`, for a specific set of cultural preferences for some country, together with all associated translations targeted to the same native language.
59+
60+
language tag
61+
: A language tag is a string used as an identifier for a language.
62+
A language tag may have one or more subtags.
63+
The basic form of a language tag is `LANGUAGE-[SUBTAG]`.
64+
65+
```{seealso}
66+
- W3C article [Language tags in HTML and XML](https://www.w3.org/International/articles/language-tags/)
67+
- W3C Working Draft [Language Tags and Locale Identifiers for the World Wide Web](https://www.w3.org/TR/ltli/)
68+
```
69+
70+
`.po`
71+
: Portable Object (PO) file.
72+
The message file format used by the {term}`gettext` translation system.
73+
See https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/PO-Files.html.
74+
75+
`.pot`
76+
: Portable Object (PO) template file, not yet oriented towards any particular language.
77+
78+
`.mo`
79+
: Machine Object file.
80+
The binary message file compiled from the {term}`.po` message file.
81+
82+
83+
(i18n-l10n-locale-and-language-tag-conventions-label)=
84+
85+
### Locale and language tag conventions
86+
87+
Plone uses certain conventions for its locales and language tags.
88+
89+
- When identifying a language only, use two lowercase letters.
90+
Examples: `en`, `de`.
91+
- When identifying a language and a country, use two lowercase letters, an underscore (`_`), and two uppercase letters.
92+
Examples: `en_GB`, `pt_BR`.
93+
- When identifying a language and script or character set, use two lowercase letters, an at sign (`@`), and four title case letters.
94+
Example: `sr@Cyrl`.
95+
96+
97+
(i18n-l10n-general-procedure-label)=
98+
99+
### General procedure
100+
101+
```{note}
102+
This section concerns only *code-level* translations of text strings.
103+
104+
For *user-generated content* translations, see {doc}`translating-content`.
105+
```
106+
107+
In general, the process of internationalization and localization of a Plone application follows these steps.
108+
109+
1. Create translatable strings in your code.
110+
Plone has already done this step within its core code.
111+
However, when developing new features or add-ons, you will need to perform this step.
112+
2. Find and extract all translatable strings from your code with a script, and create a `.pot` template file out of all these.
113+
3. Create the `.po` files for all locales.
114+
4. Edit the `.po` files, adding the translated messages into them.
115+
5. Turn the `.po` files into `.mo` files.
116+
6. Compile and link the `.mo` files with the gettext library.
117+
118+
```{seealso}
119+
[Overview of GNU `gettext`](https://www.gnu.org/software/gettext/manual/html_node/Overview.html)
120+
```
121+
122+
123+
(i18n-l10n-implementation-details-label)=
124+
125+
## Implementation details
126+
127+
Depending on which part of your Plone application that you internationalize and localize, there are different implementation details and tools that are used.
128+
These differences depend upon the programming language, either Python or JavaScript, being used by that part.
129+
130+
- For the Plone 6 frontend {term}`Volto`, see {doc}`/volto/recipes/i18n`.
131+
Volto is based on the JavaScript library React, and uses both {term}`react-intl` and {term}`gettext`.
132+
- For the rest of Plone 6, see {doc}`translating-text-strings`.
133+
This is based on Python, and uses {term}`gettext`.
134+
- For user-generated content translations, see {doc}`translating-content`.
135+
136+
137+
138+
(i18n-l10n-contents-label)=
139+
140+
## Contents
141+
142+
```{toctree}
143+
:maxdepth: 1
144+
145+
translating-text-strings
146+
language-negotiation
147+
translating-content
148+
contributing-translations
149+
```
150+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
html_meta:
3+
"description": "Accessing and changing the language state of Plone programmatically."
4+
"property=og:description": "Accessing and changing the language state of Plone programmatically."
5+
"property=og:title": "Language negotiation"
6+
"keywords": "Plone, Internationalization, i18n, language, negotiation, translation, localization"
7+
---
8+
9+
(language-negotiation-label)=
10+
11+
# Language negotiation
12+
13+
```{note}
14+
TODO: rework this section.
15+
```
16+
17+
```{admonition} Description
18+
Accessing and changing the language state of Plone programmatically.
19+
```
20+
21+
22+
## Introduction
23+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
html_meta:
3+
"description": "Translating content items in Plone, creating translations programmatically, and working with translators."
4+
"property=og:description": "Translating content items in Plone, creating translations programmatically, and working with translators."
5+
"property=og:title": "Translating content"
6+
"keywords": "Plone, Internationalization, i18n, language, translate, content, localization"
7+
---
8+
9+
(translating-content-label)=
10+
11+
# Translating content
12+
13+
```{admonition} Description
14+
Translating content items in Plone, creating translations programmatically, and working with translators.
15+
```
16+
17+
```{note}
18+
This chapter concerns only _user-generated content_ translations.
19+
20+
For *code-level* translations of text strings, see {doc}`translating-text-strings`.
21+
```
22+
23+
## Introduction
24+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
html_meta:
3+
"description": "Translating text strings in Plone"
4+
"property=og:description": "Translating text strings in Plone"
5+
"property=og:title": "Translating text strings"
6+
"keywords": "Plone, Internationalization, i18n, language, translation, localization"
7+
---
8+
9+
(translating-text-strings-label)=
10+
11+
# Translating text strings
12+
13+
```{todo}
14+
This entire chapter contains cruft dating back to Plone 3 in some parts.
15+
It is perfectly fine to purge obsolete information.
16+
```
17+
18+
```{note}
19+
This chapter concerns only *code-level* translations of text strings.
20+
21+
For *user-generated content* translations, see {doc}`translating-content`.
22+
```

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ volto/index
2525
plone.restapi/docs/source/index
2626
backend/index
2727
classic-ui/index
28+
i18n-l10n/index
2829
i18n/index
2930
contributing/index
3031
```

0 commit comments

Comments
 (0)