euroblaze / odoo_deepl

1 stars 0 forks source link

Odoo DeepL Translation Module

Overview

The Odoo DeepL Translation module integrates the DeepL translation service with Odoo to provide automatic translation of fields such as text, product descriptions, and other content. This module allows for translating content from one language to another using the DeepL API within Odoo models.

Features:


Requirements


Installation

  1. Clone the repository into your Odoo custom add-ons directory:

    git clone https://github.com/euroblaze/odoo_deepl.git
  2. Install the module using Odoo's user interface or via command line:

    ./odoo-bin -d <your-database-name> -i odoo_deepl
  3. Once installed, navigate to Settings -> General Settings and find the DeepL section to configure your API key.


Configuration

  1. API Key Setup:

    • After installation, navigate to Settings -> DeepL Configuration.
    • Input your DeepL API Key in the respective field.
  2. Language Configuration:

    • Define the source and target languages for translations. These can be managed in Odoo's Languages settings.
  3. Model Configuration:

    • You can customize which models and fields to translate here.

Usage

Once the module is installed and configured:

  1. The translation option will automatically be available for supported fields.
  2. Navigate to any supported Odoo model, such as products, and input text in the default language.
  3. Select the target language from the interface or let the module automatically translate the content based on the pre-configured settings.

Customization

Adding Translation to Custom Models/Fields

You can extend the module to enable translation for custom models or fields. Below is an example of how to add DeepL translations to a custom model:

  1. Inherit the deepl.translation.mixin class in your custom model:

    from odoo import models
    
    class YourCustomModel(models.Model):
       _inherit = 'deepl.translation.mixin'
    
       # Define translatable fields
       _translatable_fields = ['name', 'description']
  2. Define the fields you want to be translated using the _translatable_fields attribute in your custom model.


API Integration

The module communicates with the DeepL API to perform translations. Here's a breakdown of the interaction:

Key API Parameters:

Example API Usage:

The translation logic is implemented in the deepl_translation.py file, where the API request to DeepL is made using Odoo's HTTP client.


Developer Notes

Module Structure:

Extensibility:

This module is designed to be easily extensible:


Contributing

  1. Fork the repository.
  2. Create a new branch (feature/my-new-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin feature/my-new-feature).
  5. Create a new Pull Request.

License

This module is licensed under the MIT License.


Support

For issues, suggestions, or contributions, feel free to open an issue on the GitHub repository or contact the repository maintainers.


Author

Developed and maintained by Simplify-ERP.


This README provides a detailed guide to understanding, installing, and customizing the Odoo DeepL module for developers and technical users.