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/glossary.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,10 @@ Buildout
25
25
[Buildout](https://github.com/buildout/buildout/) is a Python-based tool for building and assembling applications from multiple parts, based on a configuration file.
26
26
It was the most common way of installing Plone 3, 4, and 5, and can still be used with Plone 6.
27
27
28
+
Usage of Buildout in Plone appears in various places in this documentation.
29
+
For a history and extended usage of Buildout, you can refer to the Plone 4 Documentation's section on [Buildout](https://4.docs.plone.org/old-reference-manuals/buildout/).
30
+
The Plone community authored this reference manual, as Buildout's own documentation is suboptimal.
Copy file name to clipboardExpand all lines: docs/i18n-l10n/translating-text-strings.md
+19-49Lines changed: 19 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Plone internally uses the UNIX standard {term}`gettext` tool to perform {term}`i
34
34
The package `zope.i18n` implements several APIs related to internationalization and localization.
35
35
36
36
- Follows {term}`gettext` best practices.
37
-
- Translations are stored in the `locales` folder of your application, such as `locales/fi/LC_MESSAGES/your.app.po`.
37
+
- Translations are stored in the `locales` folder of your application, such as {file}`locales/fi/LC_MESSAGES/your.app.po`.
38
38
- Uses the package [`zope.i18nmessageid`](https://pypi.org/project/zope.i18nmessageid/).
39
39
This provides a string-like class which allows storing the translation domain with translatable text strings.
40
40
- {term}`PO file`s must usually be manually converted to binary {term}`MO file`s every time the translations are updated.
@@ -56,11 +56,15 @@ Information in the PO file headers is ignored.
56
56
57
57
[`i18ndude`](https://pypi.org/project/i18ndude/) should be used to create a script which searches particular packages for translation strings.
58
58
59
-
If you have created your add-on using [bobtemplates.plone](https://pypi.org/project/bobtemplates.plone/), then you will already have a script `update.sh` inside your package and a script `update_locale` in your buildout to extract the messages from your code.
59
+
If you have created your add-on using [`bobtemplates.plone`](https://pypi.org/project/bobtemplates.plone/), then you will already have a script {file}`update.sh` inside your package and a script {file}`update_locale` in your {term}`buildout` to extract the messages from your code.
60
60
61
-
After running that script, a new `domain.pot` file will be created in your `locales` directory where all the messages will be saved.
61
+
If you have created your add-on or projects using [Cookieplone](https://github.com/plone/cookieplone), then you will already have a `make i18n` command in the {file}`backend` folder that extracts the messages from your code.
62
62
63
-
To have those messages translated into some languages, you will need to create a language directory inside the `locales` directory, and a `LC_MESSAGES` directory inside it.
63
+
This command will call `i18ndude` under the hood using `uvx`, without you needing to install it separately.
64
+
65
+
After running that script, a new {file}`domain.pot` file will be created in your {file}`locales` directory where all the messages will be saved.
66
+
67
+
To have those messages translated into some languages, you will need to create a language directory inside the {file}`locales` directory, and a {file}`LC_MESSAGES` directory inside it.
64
68
This follows the gettext standard.
65
69
After doing that, the directory structure will be as follows.
66
70
@@ -70,11 +74,11 @@ After doing that, the directory structure will be as follows.
70
74
./locales/ga/LC_MESSAGES/domain.po
71
75
```
72
76
73
-
You will need to provide your translations in those `domain.po` files.
77
+
You will need to provide your translations in those {file}`domain.po` files.
74
78
75
-
If you add, update, or remove strings in your package, you will need to run only the `update.sh` script to update all language files.
79
+
If you add, update, or remove strings in your package, you will need to run only the {file}`update.sh` script to update all language files.
76
80
77
-
You also need to have the following ZCML entry to signal Plone that the files stored in the `locales` folder follow the gettext standard and that it needs to use them when requesting translated strings.
81
+
You also need to have the following ZCML entry to signal Plone that the files stored in the {file}`locales` folder follow the gettext standard and that it needs to use them when requesting translated strings.
@@ -89,7 +93,7 @@ You also need to have the following ZCML entry to signal Plone that the files st
89
93
90
94
You will need to declare you own `MessageFactory`.
91
95
This is a callable that marks strings with a translation domain.
92
-
`MessageFactory` is usually declared in the main `__init__.py` file of your package.
96
+
`MessageFactory` is usually declared in the main {file}`__init__.py` file of your package.
93
97
It is imported from wherever it is needed in your package.
94
98
`_` is the standard name that is used in gettext to identify the translation function, and the previous scripts will use that assumption to identify translatable strings.
95
99
@@ -155,7 +159,7 @@ It will use the text content of the element as `msgid`.
155
159
Use attributes `i18n:translate`, `i18n:attributes`, and so on.
156
160
For examples, look at any core Plone `.pt` files.
157
161
158
-
The `i18n:translate` attribute will {term}`hook` into the translation machinery, and will look up the corresponding translated string to the one stated there, while looking in the relevant `domain.po` file corresponding to the `i18n:domain` stated in the file and the language negotiated by Plone.
162
+
The `i18n:translate` attribute will {term}`hook` into the translation machinery, and will look up the corresponding translated string to the one stated there, while looking in the relevant {file}`domain.po` file corresponding to the `i18n:domain` stated in the file and the language negotiated by Plone.
If you need to change a translation from a PO file, you could create a new Python package and register your own PO files.
406
376
407
-
To do this, create the package and add a `locales` directory in there, along the lines of what [plone.app.locales](https://pypi.org/project/plone.app.locales/) does.
377
+
To do this, create the package and add a {file}`locales` directory in there, along the lines of what [`plone.app.locales`](https://pypi.org/project/plone.app.locales/) does.
408
378
Then you can add your own translations in the language that you need.
409
-
For example, `locales/fr/LC_MESSAGES/plone.po` overrides French messages in the `plone` domain.
379
+
For example, {file}`locales/fr/LC_MESSAGES/plone.po` overrides French messages in the `plone` domain.
410
380
411
-
Reference the translation in `configure.zcml` of your package:
381
+
Reference the translation in {file}`configure.zcml` of your package:
0 commit comments