-
Notifications
You must be signed in to change notification settings - Fork 24
feat(translations): Add AI translation provider for OpenSPP (#767) #870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 17.0
Are you sure you want to change the base?
Changes from all commits
92d3da3
7233072
3631f6b
d56aba6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # OpenSPP Translations (AI Assisted Translation Wizard) | ||
|
|
||
| This module introduces a basic translation wizard that allows users to input | ||
| source text and generate translated output (stub implementation for now). | ||
| A follow-up iteration will integrate real translation providers. | ||
|
|
||
| - Wizard model: `translation.wizard` | ||
| - View: Form and menu entry under "Translations" | ||
| - Status: Scaffolding ready, awaiting integration with external providers. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| 'name': 'OpenSPP Translations', | ||
| 'version': '1.0', | ||
| 'summary': 'AI-assisted translation tool for OpenSPP', | ||
| 'depends': ['base'], | ||
| 'data': [ | ||
| 'views/translation_wizard_view.xml', | ||
| ], | ||
| 'installable': True, | ||
| 'application': False, | ||
| } | ||
|
|
||
|
|
||
| 'license': 'LGPL-3', | ||
| 'author': 'Devendra Chauhan', | ||
| 'website': 'https://github.com/devendra1973', | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import translation_wizard |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||||||||||||||||||||||||||||
| from odoo import models, fields, api | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| class TranslationWizard(models.TransientModel): | ||||||||||||||||||||||||||||||||
| _name = 'translation.wizard' | ||||||||||||||||||||||||||||||||
| _description = 'AI-Assisted Translation Wizard' | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| source_text = fields.Text("Source Text", required=True) | ||||||||||||||||||||||||||||||||
| translated_text = fields.Text("Translated Text") | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| @api.model | ||||||||||||||||||||||||||||||||
| def translate_text(self): | ||||||||||||||||||||||||||||||||
| # Simple placeholder logic (we fake translation for now) | ||||||||||||||||||||||||||||||||
| self.translated_text = f"TRANSLATED: {self.source_text}" | ||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+13
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Additionally, to improve usability, the method should return an action to reopen the wizard. This will refresh the view and display the
Suggested change
|
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
|
|
||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <odoo> | ||
| <record id="view_translation_provider_form" model="ir.ui.view"> | ||
| <field name="name">translation.provider.form</field> | ||
| <field name="model">translation.provider</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="AI Translation Provider"> | ||
| <sheet> | ||
| <group> | ||
| <field name="name"/> | ||
| <field name="provider_type"/> | ||
| <field name="api_key"/> | ||
| <field name="endpoint"/> | ||
| </group> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="action_translation_provider" model="ir.actions.act_window"> | ||
| <field name="name">AI Translation Providers</field> | ||
| <field name="res_model">translation.provider</field> | ||
| <field name="view_mode">tree,form</field> | ||
| </record> | ||
|
|
||
| <menuitem id="menu_translation_provider" | ||
| name="AI Translation Provider" | ||
| parent="base.menu_custom" | ||
| action="action_translation_provider"/> | ||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <odoo> | ||
| <record id="view_translation_wizard" model="ir.ui.view"> | ||
| <field name="name">translation.wizard.form</field> | ||
| <field name="model">translation.wizard</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="AI Translation Tool"> | ||
| <group> | ||
| <field name="source_text"/> | ||
| <field name="translated_text" readonly="1"/> | ||
| </group> | ||
| <footer> | ||
| <button name="translate_text" string="Translate" type="object" class="btn-primary"/> | ||
| <button string="Close" class="btn-secondary" special="cancel"/> | ||
| </footer> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="action_translation_wizard" model="ir.actions.act_window"> | ||
| <field name="name">AI Translate</field> | ||
| <field name="res_model">translation.wizard</field> | ||
| <field name="view_mode">form</field> | ||
| <field name="target">new</field> | ||
| </record> | ||
|
|
||
| <menuitem id="menu_translation_root" name="Translation" sequence="10"/> | ||
| <menuitem id="menu_translation_tool" name="AI Translator" parent="menu_translation_root" action="action_translation_wizard"/> | ||
| </odoo> | ||
| o | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manifest file has a syntax error. The
license,author, andwebsitekeys are defined outside of the main dictionary, which makes the file invalid. These keys must be moved inside the dictionary for Odoo to correctly load the module.{ 'name': 'OpenSPP Translations', 'version': '1.0', 'summary': 'AI-assisted translation tool for OpenSPP', 'depends': ['base'], 'data': [ 'views/translation_wizard_view.xml', ], 'installable': True, 'application': False, 'license': 'LGPL-3', 'author': 'Devendra Chauhan', 'website': 'https://github.com/devendra1973', }