Skip to content

Commit 4768d17

Browse files
authored
Merge pull request plone#1296 from plone/add-i18n
Add i18n and l10n
2 parents be2837d + 831e77b commit 4768d17

12 files changed

+1267
-4
lines changed
114 KB
Loading
117 KB
Loading

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
# Ignore specific anchors
8080
r"https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors#Identifying_the_issue",
8181
r"https://github.com/browserslist/browserslist#queries",
82+
r"https://github.com/plone/cookiecutter-zope-instance#options",
8283
r"https://github.com/plone/plone.docker#for-basic-usage",
8384
r"https://github.com/plone/plone.rest#cors",
8485
r"https://github.com/plone/plone.volto/blob/6f5382c74f668935527e962490b81cb72bf3bc94/src/kitconcept/volto/upgrades.py#L6-L54",

docs/glossary.md

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ CloudFormation
9999
100100
Travis CI
101101
Travis CI is a hosted, distributed continuous integration service used to build and test software projects hosted at GitHub.
102-
Open source projects may be tested with limited runs via [travis-ci.org](https://travis-ci.org).
102+
Open source projects may be tested with limited runs via [travis-ci.com](https://www.travis-ci.com).
103103
104104
Solr
105105
[Solr](https://solr.apache.org/) is a popular, blazing-fast, open source enterprise search platform built on Apache Lucene.
@@ -355,15 +355,90 @@ elementEditor
355355
A generic {term}`volto-slate` plugin architecture that can be used to create other editor interactions that follow the pattern of having a button that toggles a format (an inline element).
356356
It also creates a separate edit form for advanced customization of the data attached to the element.
357357
358+
i18n
359+
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.
363+
"i18n" is shorthand for "internationalization" (the letter "I", 18 letters, the letter "N").
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+
```
395+
396+
gettext
397+
UNIX standard software translation tool.
398+
See https://www.gnu.org/software/gettext/.
399+
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+
409+
PO file
410+
`.po`
411+
Portable Object (PO) file.
412+
The file format used by the {term}`gettext` translation system.
413+
See https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/PO-Files.html.
414+
415+
PO template file
416+
`.pot`
417+
Portable Object (PO) template file, not yet oriented towards any particular language.
418+
419+
MO file
420+
`.mo`
421+
Machine Object file.
422+
The binary message file compiled from the {term}`.po` message file.
423+
424+
i18ndude
425+
Support tool to create and update message catalogs from instrumented source code.
426+
427+
manual `.po` entries
428+
Entries which cannot be detected by an automatic code scan.
429+
430+
react-intl
431+
A library that is part of [Format.JS](https://formatjs.io/docs/getting-started/installation) which helps developers set up their applications for internationalization.
432+
358433
WSGI
359434
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.
360435
361436
ZEO
362-
[ZEO](https://zeo.readthedocs.io/) is a client-server storage for ZODB for sharing a single storage among many clients.
437+
[ZEO](https://zeo.readthedocs.io/en/latest/) is a client-server storage for ZODB for sharing a single storage among many clients.
363438
364439
ZODB
365-
[A native object database for Python](https://zodb.org/).
440+
[A native object database for Python](https://zodb.org/en/latest/).
366441
367442
Zope
368-
[Zope](https://zope.readthedocs.io/) is a Python-based application server for building secure and highly scalable web applications.
443+
[Zope](https://zope.readthedocs.io/en/latest/) is a Python-based application server for building secure and highly scalable web applications.
369444
```
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
myst:
3+
html_meta:
4+
"description": "How to contribute to Plone core translations."
5+
"property=og:description": "How to contribute to Plone core translations."
6+
"property=og:title": "Contributing Plone Core Translations"
7+
"keywords": "Plone, Internationalization, i18n, language, translation, localization"
8+
---
9+
10+
(contributing-plone-core-translations-label)=
11+
12+
# Contributing Plone Core Translations
13+
14+
```{admonition} Description
15+
How to contribute to the Plone translations.
16+
```
17+
18+
This chapter of the documentation describes how to contribute to Plone's translations.
19+
Plone fully supports {term}`internationalization` and {term}`localization`.
20+
Plone Classic UI comes with 65 local language translations, and the new default frontend Volto comes with 12, at the time of this writing.
21+
However, some translations are incomplete, or certain languages have not yet been added.
22+
Translations can be added or updated as needed by the citizens of Earth.
23+
You will need to work in one repository for Plone core, and optionally another one for Volto.
24+
25+
26+
(contributing-plone-core-translations-pre-requisites-label)=
27+
28+
## Pre-requisites
29+
30+
Request write access to https://github.com/collective/plone.app.locales to be able to commit your translation directly.
31+
32+
To do so, [join the collective GitHub organization](https://collective.github.io/).
33+
34+
Optionally sign the [Plone Contributor Agreement](https://plone.org/foundation/contributors-agreement) for translating Volto.
35+
36+
37+
(contributing-plone-core-translations-translate-plone-classic-ui-label)=
38+
39+
## Translate Plone Classic UI
40+
41+
The process of translating Plone Classic UI is the following.
42+
43+
1. Go to https://github.com/collective/plone.app.locales and clone it into your computer.
44+
45+
2. Create a new branch to work on your translations.
46+
Name the branch with something identifiable.
47+
For example: `{language}-{date}` (`fr-20220731`).
48+
49+
3. Either update or create a translation.
50+
51+
- To _update_ an existing translation, translate the {term}`PO file`s under your language of choice at `plone/app/locales/locales/{language_code}/LC_MESSAGES/*.po`.
52+
In Classic UI, we have several language files because some of the original messages are spread over several language domains and products.
53+
- To _create_ a translation, create a new directory at `plone/app/locales/locales/{language_code}/LC_MESSAGES`, copy all the `.pot` files in `plone/app/locales/locales` to your new directory, rename the files in your directory by changing the file extension to `.po`, and start translating.
54+
55+
4. Commit your changes, and create a pull request with them.
56+
Request a review from a colleague, especially if you are translating a file that already has some translations.
57+
You can check the file's commit history with `git blame <filename>` to see previous contributors and request a review from them.
58+
This is to ensure coherent translations throughout Plone.
59+
60+
61+
(contributing-plone-core-translations-translate-volto-label)=
62+
63+
## Translate Volto
64+
65+
The process of translating the Volto frontend is the following.
66+
67+
1. Go to https://github.com/plone/volto and clone it into your computer.
68+
69+
2. Create a new branch to prepare the translations.
70+
Name the branch with something identifiable.
71+
For example: `{language}-{date}` (`fr-20220731`).
72+
73+
3. Either update or create a translation.
74+
75+
- To update a translation, translate your language's `po` file found at `locales/{language_code}/LC_MESSAGES/volto.po`.
76+
- To create a new translation, create a new directory at `locales/{language_code}/LC_MESSAGES/`, copy the file `locales/volto.pot` to `locales/{language_code}/LC_MESSAGES/volto.po` (note to drop the trailing `t`), and start translating.
77+
78+
4. Commit your changes, and create a pull request.
79+
80+
81+
(contributing-plone-core-translations-support-label)=
82+
83+
## Support
84+
85+
Please ask questions on the Plone Community Forum category [Translations and i18n/l10n](https://community.plone.org/c/development/i18nl10n/42).

docs/i18n-l10n/index.md

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

0 commit comments

Comments
 (0)