translate
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_otk_translation_config_list" model="ir.ui.view">
|
||||
<field name="name">otk.translation.config.list</field>
|
||||
<field name="model">otk.translation.config</field>
|
||||
<field name="arch" type="xml">
|
||||
<list>
|
||||
<field name="model_id"/>
|
||||
<field name="has_translatable_fields"/>
|
||||
<field name="translatable_field_ids" widget="many2many_tags"/>
|
||||
<field name="active" widget="boolean_toggle"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_otk_translation_config_form" model="ir.ui.view">
|
||||
<field name="name">otk.translation.config.form</field>
|
||||
<field name="model">otk.translation.config</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="action_view_translatable_fields"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-list"
|
||||
invisible="not has_translatable_fields">
|
||||
<field name="has_translatable_fields" invisible="1"/>
|
||||
<span>Translatable Fields</span>
|
||||
</button>
|
||||
</div>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="text-bg-danger" invisible="active"/>
|
||||
<group>
|
||||
<group>
|
||||
<field name="model_id" options="{'no_create': True}"/>
|
||||
<field name="active" widget="boolean_toggle"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="server_action_id" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="Translatable Fields" invisible="not has_translatable_fields">
|
||||
<field name="translatable_field_ids" widget="many2many_tags" nolabel="1" colspan="2" readonly="1"/>
|
||||
</group>
|
||||
<div class="alert alert-warning" role="alert" invisible="has_translatable_fields">
|
||||
<strong>Warning:</strong> This model has no translatable fields. Bulk translation will not be useful.
|
||||
</div>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_otk_translation_config_search" model="ir.ui.view">
|
||||
<field name="name">otk.translation.config.search</field>
|
||||
<field name="model">otk.translation.config</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="model_id"/>
|
||||
<filter name="active" string="Active" domain="[('active', '=', True)]"/>
|
||||
<filter name="inactive" string="Archived" domain="[('active', '=', False)]"/>
|
||||
<filter name="has_fields" string="With Translatable Fields" domain="[('has_translatable_fields', '=', True)]"/>
|
||||
<group>
|
||||
<filter string="Active" name="group_active" context="{'group_by': 'active'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_otk_translation_config" model="ir.actions.act_window">
|
||||
<field name="name">Translation Configuration</field>
|
||||
<field name="res_model">otk.translation.config</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="context">{'search_default_active': 1}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Configure models for bulk translation
|
||||
</p>
|
||||
<p>
|
||||
Add models here to enable the "Bulk translate" action on their list views.
|
||||
No code changes required - just select a model and it will automatically
|
||||
get the bulk translation feature.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Wizard to enable all translatable models at once -->
|
||||
<record id="action_enable_all_translatable_models" model="ir.actions.server">
|
||||
<field name="name">Enable All Translatable Models</field>
|
||||
<field name="model_id" ref="model_otk_translation_config"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.action_enable_all_translatable_models()</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="otoolkit_translation_config_menu"
|
||||
name="Translation Settings"
|
||||
parent="otoolkit_menu"
|
||||
action="action_otk_translation_config"
|
||||
sequence="120"
|
||||
/>
|
||||
</odoo>
|
||||
@@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_otoolkit_translation_action_list" model="ir.ui.view">
|
||||
<field name="name">otk.translation.action.list</field>
|
||||
<field name="model">otk.translation.action</field>
|
||||
<field name="arch" type="xml">
|
||||
<list>
|
||||
<field name="id"/>
|
||||
<field name="model_id" />
|
||||
<field name="field_ids" widget="many2many_tags" />
|
||||
<field name="translation_count" />
|
||||
<field name="skipped_count" optional="show"/>
|
||||
<field name="token_cost" />
|
||||
<field name="status" />
|
||||
<field name="progress" widget="progressbar"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_otoolkit_translation_action_form" model="ir.ui.view">
|
||||
<field name="name">otk.translation.action.form</field>
|
||||
<field name="model">otk.translation.action</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<header>
|
||||
<button invisible="status!='error'" name="retry_error_translation" string="Retry translation" type="object" class="btn-primary" />
|
||||
</header>
|
||||
<sheet>
|
||||
<!-- Skipped records alert -->
|
||||
<div class="alert alert-warning" role="alert"
|
||||
invisible="skipped_count == 0">
|
||||
<strong>
|
||||
<i class="fa fa-exclamation-triangle" title="Skipped records"/>
|
||||
<field name="skipped_count" class="d-inline"/> records skipped
|
||||
</strong>
|
||||
— these records had no translatable content in the selected fields and were not sent to the API (no tokens consumed).
|
||||
</div>
|
||||
<!-- Server-side processing alert -->
|
||||
<div class="alert alert-info" role="alert"
|
||||
invisible="status != 'processing' or processing_count == 0">
|
||||
<strong>
|
||||
<i class="fa fa-spinner" title="Translating"/>
|
||||
<field name="processing_count" class="d-inline"/> record(s) being translated on the O'Toolkit server.
|
||||
</strong>
|
||||
Large contents can take several minutes. Results are fetched automatically every few minutes —
|
||||
last check: <field name="last_server_check" class="d-inline"/>
|
||||
</div>
|
||||
<group>
|
||||
<group string="Configuration">
|
||||
<field name="model_id" />
|
||||
<field name="status" />
|
||||
<field name="base_language_id" />
|
||||
<field name="target_language_ids" widget="many2many_tags" />
|
||||
<field name="field_ids" widget="many2many_tags" />
|
||||
<field name="overwrite_existing" />
|
||||
</group>
|
||||
<group string="Progress">
|
||||
<field name="translation_count" />
|
||||
<field name="token_cost" />
|
||||
<field name="progress" widget="progressbar" />
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Translations" name="translations">
|
||||
<field name="translation_ids">
|
||||
<list create="0" delete="0">
|
||||
<field name="record_id" />
|
||||
<field name="cost" />
|
||||
<field name="status" />
|
||||
<field name="last_server_check" optional="show" />
|
||||
</list>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Record IDs" name="record_ids">
|
||||
<group>
|
||||
<field name="pending_record_ids" widget="jsonb" />
|
||||
<field name="processing_record_ids" widget="jsonb" />
|
||||
<field name="done_record_ids" widget="jsonb" />
|
||||
<field name="error_record_ids" widget="jsonb" />
|
||||
<field name="skipped_record_ids" widget="jsonb" />
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_otoolkit_translation_list" model="ir.ui.view">
|
||||
<field name="name">otk.translation.list</field>
|
||||
<field name="model">otk.translation</field>
|
||||
<field name="arch" type="xml">
|
||||
<list>
|
||||
<field name="id"/>
|
||||
<field name="model_id" />
|
||||
<field name="record_id" />
|
||||
<field name="action_id" />
|
||||
<field name="status" />
|
||||
<field name="last_server_check" optional="show" />
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_otoolkit_translation_form" model="ir.ui.view">
|
||||
<field name="name">otk.translation.form</field>
|
||||
<field name="model">otk.translation</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<header>
|
||||
<button invisible="status!='success'" name="revert_translation" string="Revert translation" type="object" class="btn-primary" />
|
||||
<button name="open_record" string="Open record" type="object" />
|
||||
</header>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="model_id" />
|
||||
<field name="record_id" />
|
||||
<field name="status" />
|
||||
<field name="last_server_check" invisible="status != 'pending'" />
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Translations">
|
||||
<field name="translations" widget="json_pretty" />
|
||||
</page>
|
||||
<page string="Initial value" invisible="status!='success' and status!='revert'">
|
||||
<field name="initial_values" widget="json_pretty" />
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_otoolkit_translation" model="ir.actions.act_window">
|
||||
<field name="name">Translation actions</field>
|
||||
<field name="res_model">otk.translation</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
|
||||
<record id="action_otoolkit_translation_action" model="ir.actions.act_window">
|
||||
<field name="name">Translation actions</field>
|
||||
<field name="res_model">otk.translation.action</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="otoolkit_menu"
|
||||
name="Otoolkit"
|
||||
parent="base.menu_custom"
|
||||
sequence="100"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
id="otoolkit_translation_actions_menu"
|
||||
name="Bulk translations"
|
||||
parent="otoolkit_menu"
|
||||
action="action_otoolkit_translation_action"
|
||||
sequence="105"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
id="otoolkit_translation_menu"
|
||||
name="Past translations"
|
||||
parent="otoolkit_menu"
|
||||
action="action_otoolkit_translation"
|
||||
sequence="110"
|
||||
/>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user