Skip to content

Commit 6b1b464

Browse files
committed
Update README
1 parent c608d35 commit 6b1b464

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,55 @@ The project is licensed under GPLv2.
6060
## Credits and Acknowledgements 🙏
6161

6262
Crafted with care by **Generated using [Cookieplone (0.8.1)](https://github.com/plone/cookieplone) and [cookiecutter-plone (f3a6293)](https://github.com/plone/cookiecutter-plone/commit/f3a6293bd1d64bcb7ff67e4ae53fc4ee5223e7c1) on 2024-11-30 11:19:21.252928**. A special thanks to all contributors and supporters!
63+
64+
## Adding a New Tool
65+
66+
If you would like to add a new translation tool, follow these steps:
67+
68+
1. **Create a New Directory for the Translation Tool**
69+
70+
- Create a new directory for the translation tool inside the `src` folder of your Plone add-on:
71+
`[collective.translators/src/collective/translators/{YOUR_TOOL}]`.
72+
73+
- Inside the new directory, add the following files:
74+
- `__init__.py`
75+
- `utility.py`
76+
- `configure.zcml`
77+
78+
- The `__init__.py` file should be empty. For the other files, follow the structure of the already implemented tools with the same filenames.
79+
80+
- Note: The `available_languages` method in the `utility.py` file can return an empty array. In this case, it will be assumed that the tool can translate between any languages.
81+
82+
2. **Update the Add-on Configuration**
83+
84+
- Register the new tool in your add-on's main `configure.zcml` file:
85+
`[collective.translators/src/collective/translators/configure.zcml]`.
86+
87+
- Add the following line:
88+
`<include package=".{YOUR_ADDON}" />`
89+
90+
3. **Create the Registry for Your New Tool**
91+
92+
- Open the `interfaces.py` file:
93+
`[collective.translators/src/collective/translators/interfaces.py]`.
94+
95+
- Add your new interface, following the structure of the others already implemented there.
96+
97+
- Open the `main.xml` file:
98+
`[collective.translators/src/collective/translators/profiles/default/registry/main.xml]`.
99+
100+
- Add the configuration for your tool, following the structure of the other entries. It should look like this:
101+
102+
<records interface="collective.translators.interfaces.IYourToolControlPanel">
103+
<value key="enabled">False</value>
104+
<value key="order">30</value>
105+
<value key="source_languages"></value>
106+
<value key="target_languages"></value>
107+
<value key="api_key">YOUR_TOOL_API_KEY</value>
108+
</records>
109+
110+
4. **Create your personalized control panel**
111+
Inside the controlpanel folder [collective.translators/src/collective/translators/controlpanel] open "controlpanel.py" and add the configuration of your tool's controlpanel and the adapter. Then, register the adapter and the view in the configure.zcml file within the same folder. Now open the "controlpanel.xml" at [collective.translators/src/collective/translators/profiles/default/controlpanel.xml] and add the configlet.
112+
113+
5. **Test your new tool**
114+
Access to your new control panel in your Plone site, add your API key and test your tool.

0 commit comments

Comments
 (0)