Skip to content

Commit 8a47e3a

Browse files
authored
Merge pull request #186 from collective/i18n_support
2 parents 1d3f5d3 + ca3878c commit 8a47e3a

25 files changed

Lines changed: 1567 additions & 184 deletions

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Changelog
55
1.8 (unreleased)
66
----------------
77

8+
- Add Spanish translation.
9+
[macagua]
10+
11+
- Add i18n support.
12+
[macagua]
13+
814
- Fix html: improve mapping from scale to picture variant. [maurits]
915

1016
- Allow overriding the fallback variant in img_variant_fixer.

CONTRIBUTORS.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ Contributors
55

66
- Maurits van Rees, m.van.rees@zestsoftware.nl
77

8-
- Fred van Dijk, f.van.dijk@zestsoftware.nl
8+
- Fred van Dijk, f.van.dijk@zestsoftware.nl
9+
10+
- Leonardo J. Caballero G., leonardocaballero@gmail.com

README.rst

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Export and import all kinds of data from and to Plone sites using a intermediate
2727
The main use-case is migrations since it enables you to for example migrate from Plone 4 with Archetypes and Python 2 to Plone 6 with Dexterity and Python 3 in one step.
2828
Most features use `plone.restapi` to serialize and deserialize data.
2929

30-
See also the training on migrating with exportimport: https://training.plone.org/migrations/exportimport.html
30+
See also the training on migrating with ``exportimport``: https://training.plone.org/migrations/exportimport.html
3131

3232
.. contents:: Contents
3333
:local:
@@ -96,7 +96,7 @@ When a in-place-migration is not required you can choose this addon to migrate t
9696

9797
* Export content from a Plone site (it supports Plone 4 and 5, Archetypes and Dexterity, Python 2 and 3).
9898
* Import the exported content into a new site (Plone 5.2+, Dexterity, Python 3)
99-
* Export and import relations, users and groups with their roles, translations, local roles, ordering, dedault-pages, comments, portlets and redirects.
99+
* Export and import relations, users and groups with their roles, translations, local roles, ordering, default-pages, comments, portlets and redirects.
100100

101101
How to migrate additional features like Annotations or Marker Interfaces is discussed in the FAQ section.
102102

@@ -107,7 +107,7 @@ You can use this addon to
107107

108108
* Archive your content as json
109109
* Export data to prepare a migration to another system
110-
* Combine content from mutiple plone-sites into one.
110+
* Combine content from multiple plone-sites into one.
111111
* Import a plone-site as a subsite into another.
112112
* Import content from other systems as long as it fits the required format.
113113
* Update or replace existing data
@@ -156,8 +156,8 @@ To fix this you can check the checkbox "Modify exported data for migrations".
156156
This will modify the data during export:
157157

158158
* Drop unused data (e.g. `next_item` and `components`)
159-
* Remove all relationfields
160-
* Change some fieldnames that changed between AT and DX
159+
* Remove all relation fields
160+
* Change some field names that changed between Archetypes and Dexterity
161161

162162
* ``excludeFromNav`` → ``exclude_from_nav``
163163
* ``allowDiscussion`` → ``allow_discussion``
@@ -174,8 +174,8 @@ This will modify the data during export:
174174
* ``contactName`` → ``contact_name``
175175
* ``contactPhone`` → ``contact_phone``
176176

177-
* Update view names on Folders and Collection thet changed since Plone 4.
178-
* Export ATTopic and their criteria to Collections with querystrings.
177+
* Update view names on Folders and Collection that changed since Plone 4.
178+
* Export ``ATTopic`` and their criteria to Collections with querystrings.
179179
* Update Collection-criteria.
180180
* Links and images in Richtext-Fields of content and portlets have changes since Plone 4.
181181
the view ``/@@fix_html`` allows you to fix these.
@@ -191,8 +191,8 @@ You can choose between four options how to deal with content that already exists
191191
* Update: Reuse and only overwrite imported data
192192
* Ignore: Create with a new id
193193

194-
Imported content is initially created with ``invokeFactory`` using portal_type and id of the exported item before deserialing the rest of the data.
195-
You can set additional values by specifying a dict ``factory_kwargs`` that will be passed to the facory.
194+
Imported content is initially created with ``invokeFactory`` using portal_type and id of the exported item before deserializing the rest of the data.
195+
You can set additional values by specifying a dict ``factory_kwargs`` that will be passed to the factory.
196196
Like this you can set values on the imported object that are expected to be there by subscribers to IObjectAddedEvent.
197197

198198

@@ -558,7 +558,7 @@ Here we drop empty lines from the creators:
558558
item["creators"] = [i for i in item.get("creators", []) if i]
559559
return item
560560
561-
This example migrates a PloneHelpCenter to a simple folder/document structure during import.
561+
This example migrates a ``PloneHelpCenter`` to a simple folder/document structure during import.
562562
There are a couple more types to handle (as folder or document) but you get the idea, don't you?
563563

564564
.. code-block:: python
@@ -834,7 +834,7 @@ It may also happen, when you have validators that rely on content or configurati
834834

835835
.. note::
836836

837-
For relationfields this is not necessary since relations are imported after content anyway!
837+
For relation fields this is not necessary since relations are imported after content anyway!
838838

839839
There are two ways to handle these issues:
840840

@@ -1279,7 +1279,7 @@ This custom export exports and imports some selected settings and addons from a
12791279
**Import:**
12801280

12811281
The import installs the addons and load the settings in the registry.
1282-
Since Plone 5 portal_properties is no longer used.
1282+
Since Plone 5 ``portal_properties`` is no longer used.
12831283

12841284
.. code-block:: python
12851285
@@ -1450,7 +1450,7 @@ Export:
14501450
)
14511451
return actions
14521452
1453-
Import exported PloneFormGen data into Easyform:
1453+
Import exported ``PloneFormGen`` data into ``Easyform``:
14541454

14551455
.. code-block:: python
14561456
@@ -2131,6 +2131,13 @@ Written by
21312131
:alt: Starzel.de
21322132

21332133

2134+
Translations
2135+
============
2136+
2137+
This product has been translated into
2138+
2139+
- Spanish
2140+
21342141

21352142
Installation
21362143
============
@@ -2147,14 +2154,14 @@ Install collective.exportimport by adding it to your buildout::
21472154

21482155
and then running ``bin/buildout``
21492156

2150-
You don't need to activate the add-on in the Site Setup Add-ons control panel to be able to use the forms @@export_content and @@import_content in your site.
2157+
You don't need to activate the add-on in the Site Setup Add-ons control panel to be able to use the forms ``@@export_content`` and ``@@import_content`` in your site.
21512158

21522159
You do need to add it to your buildout configuration and run buildout to make these features available at all. See https://docs.plone.org/manage/installing/installing_addons.html for details.
21532160

21542161
Installing in Plone 4
21552162
---------------------
21562163

2157-
collective.exportimport depends on plone.restapi . For Plone 4, you need to pin plone.restapi to 7.x . When installing plone.restapi version 7.x.x in Plone 4 you may need to add the following version pins to your buildout::
2164+
``collective.exportimport`` depends on ``plone.restapi``. For Plone 4, you need to pin ``plone.restapi`` to 7.x . When installing ``plone.restapi`` version 7.x.x in Plone 4 you may need to add the following version pins to your buildout::
21582165

21592166
[versions]
21602167
PyJWT = 1.7.1
@@ -2191,8 +2198,7 @@ collective.exportimport depends on plone.restapi . For Plone 4, you need to pin
21912198
contextlib2 = 0.6.0.post1
21922199

21932200

2194-
These versions are taken from the plone.restapi 7.x README: https://pypi.org/project/plone.restapi/7.8.1/
2195-
2201+
These versions are taken from the ``plone.restapi`` 7.x README: https://pypi.org/project/plone.restapi/7.8.1/
21962202

21972203

21982204
Contribute

src/collective/exportimport/export_content.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from Acquisition import aq_base
33
from App.config import getConfiguration
4+
from collective.exportimport import _
45
from collective.exportimport import config
56
from collective.exportimport.interfaces import IBase64BlobsMarker
67
from collective.exportimport.interfaces import IMigrationMarker
@@ -119,7 +120,7 @@ def __call__(
119120

120121
self.depth = int(depth)
121122
self.depth_options = (
122-
("-1", "unlimited"),
123+
("-1", _(u"unlimited")),
123124
("0", "0"),
124125
("1", "1"),
125126
("2", "2"),
@@ -134,9 +135,9 @@ def __call__(
134135
)
135136
self.include_blobs = int(include_blobs)
136137
self.include_blobs_options = (
137-
("0", "as download urls"),
138-
("1", "as base-64 encoded strings"),
139-
("2", "as blob paths"),
138+
("0", _(u"as download urls")),
139+
("1", _(u"as base-64 encoded strings")),
140+
("2", _(u"as blob paths")),
140141
)
141142
self.include_revisions = include_revisions
142143

@@ -146,7 +147,7 @@ def __call__(
146147
return self.template()
147148

148149
if not self.portal_type:
149-
api.portal.show_message(u"Select at least one type to export", self.request)
150+
api.portal.show_message(_(u"Select at least one type to export"), self.request)
150151
return self.template()
151152

152153
if self.include_blobs == 1:
@@ -194,7 +195,7 @@ def __call__(
194195
json.dump(datum, f, sort_keys=True, indent=4)
195196
if number:
196197
f.write("]")
197-
msg = u"Exported {} items ({}) as {} to {}".format(
198+
msg = _(u"Exported {} items ({}) as {} to {}").format(
198199
number, ", ".join(self.portal_type), filename, filepath
199200
)
200201
logger.info(msg)
@@ -218,7 +219,7 @@ def __call__(
218219
json.dump(datum, f, sort_keys=True, indent=4)
219220
if number:
220221
f.write("]")
221-
msg = u"Exported {} {}".format(number, self.portal_type)
222+
msg = _(u"Exported {} {}").format(number, self.portal_type)
222223
logger.info(msg)
223224
api.portal.show_message(msg, self.request)
224225
response = self.request.response

src/collective/exportimport/export_other.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from Acquisition import aq_base
33
from App.config import getConfiguration
4+
from collective.exportimport import _
45
from collective.exportimport import config
56
from OFS.interfaces import IOrderedContainer
67
from operator import itemgetter
@@ -80,7 +81,7 @@ class BaseExport(BrowserView):
8081
def download(self, data):
8182
filename = u"{}.json".format(self.__name__)
8283
if not data:
83-
msg = u"No data to export for {}".format(self.__name__)
84+
msg = _(u"No data to export for {}").format(self.__name__)
8485
logger.info(msg)
8586
api.portal.show_message(msg, self.request)
8687
return self.request.response.redirect(self.request["ACTUAL_URL"])
@@ -97,7 +98,7 @@ def download(self, data):
9798
filepath = os.path.join(directory, filename)
9899
with open(filepath, "w") as f:
99100
json.dump(data, f, sort_keys=True, indent=4)
100-
msg = u"Exported to {}".format(filepath)
101+
msg = _(u"Exported to {}").format(filepath)
101102
logger.info(msg)
102103
api.portal.show_message(msg, self.request)
103104
return self.request.response.redirect(self.request["ACTUAL_URL"])
@@ -121,7 +122,7 @@ class ExportRelations(BaseExport):
121122
def __call__(
122123
self, download_to_server=False, debug=False, include_linkintegrity=False
123124
):
124-
self.title = "Export relations"
125+
self.title = _(u"Export relations")
125126
self.download_to_server = download_to_server
126127
if not self.request.form.get("form.submitted", False):
127128
return self.index()
@@ -229,7 +230,7 @@ class ExportMembers(BaseExport):
229230
def __init__(self, context, request):
230231
super(ExportMembers, self).__init__(context, request)
231232
self.pms = api.portal.get_tool("portal_membership")
232-
self.title = "Export members, groups and roles"
233+
self.title = _(u"Export members, groups and roles")
233234
self.group_roles = {}
234235

235236
def __call__(self, download_to_server=False):
@@ -327,7 +328,7 @@ class ExportTranslations(BaseExport):
327328
DROP_PATH = []
328329

329330
def __call__(self, download_to_server=False):
330-
self.title = "Export translations"
331+
self.title = _(u"Export translations")
331332
self.download_to_server = download_to_server
332333
if not self.request.form.get("form.submitted", False):
333334
return self.index()
@@ -409,7 +410,7 @@ class ExportLocalRoles(BaseExport):
409410
"""Export all local roles"""
410411

411412
def __call__(self, download_to_server=False):
412-
self.title = "Export local roles"
413+
self.title = _(u"Export local roles")
413414
self.download_to_server = download_to_server
414415
if not self.request.form.get("form.submitted", False):
415416
return self.index()
@@ -466,7 +467,7 @@ class ExportOrdering(BaseExport):
466467
"""Export all local roles"""
467468

468469
def __call__(self, download_to_server=False):
469-
self.title = "Export ordering"
470+
self.title = _(u"Export ordering")
470471
self.download_to_server = download_to_server
471472
if not self.request.form.get("form.submitted", False):
472473
return self.index()
@@ -502,7 +503,7 @@ class ExportDefaultPages(BaseExport):
502503
"""Export all default_page settings."""
503504

504505
def __call__(self, download_to_server=False):
505-
self.title = "Export default pages"
506+
self.title = _(u"Export default pages")
506507
self.download_to_server = download_to_server
507508
if not self.request.form.get("form.submitted", False):
508509
return self.index()
@@ -581,7 +582,7 @@ def get_default_page_info(self, obj):
581582

582583
class ExportDiscussion(BaseExport):
583584
def __call__(self, download_to_server=False):
584-
self.title = "Export comments"
585+
self.title = _(u"Export comments")
585586
self.download_to_server = download_to_server
586587
if not self.request.form.get("form.submitted", False):
587588
return self.index()
@@ -620,7 +621,7 @@ def all_discussions(self):
620621

621622
class ExportPortlets(BaseExport):
622623
def __call__(self, download_to_server=False):
623-
self.title = "Export portlets"
624+
self.title = _(u"Export portlets")
624625
self.download_to_server = download_to_server
625626
if not self.request.form.get("form.submitted", False):
626627
return self.index()
@@ -755,7 +756,7 @@ def export_plone_redirects():
755756

756757
class ExportRedirects(BaseExport):
757758
def __call__(self, download_to_server=False):
758-
self.title = "Export redirects"
759+
self.title = _(u"Export redirects")
759760
self.download_to_server = download_to_server
760761
if not self.request.form.get("form.submitted", False):
761762
return self.index()

src/collective/exportimport/fix_html.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: UTF-8 -*-
22
from Acquisition import aq_parent
33
from bs4 import BeautifulSoup
4+
from collective.exportimport import _
45
from collections import defaultdict
56
from logging import getLogger
67
from plone import api
@@ -39,19 +40,19 @@
3940

4041
class FixHTML(BrowserView):
4142
def __call__(self):
42-
self.title = "Fix links to content and images in richtext"
43+
self.title = _(u"Fix links to content and images in richtext")
4344
if not self.request.form.get("form.submitted", False):
4445
return self.index()
4546
commit = self.request.form.get("form.commit", True)
4647

4748
msg = []
4849

4950
fix_count = fix_html_in_content_fields(context=self.context, commit=commit)
50-
msg.append(u"Fixed HTML for {} fields in content items".format(fix_count))
51+
msg.append(_(u"Fixed HTML for {} fields in content items").format(fix_count))
5152
logger.info(msg[-1])
5253

5354
fix_count = fix_html_in_portlets(context=self.context)
54-
msg.append(u"Fixed HTML for {} portlets".format(fix_count))
55+
msg.append(_(u"Fixed HTML for {} portlets").format(fix_count))
5556
logger.info(msg[-1])
5657

5758
# TODO: Fix html in tiles

0 commit comments

Comments
 (0)