models.py 994 B

12345678910111213141516171819202122232425262728
  1. # -*- coding: utf-8 -*-
  2. from odoo import fields, models, _, _lt
  3. from odoo.tools.translate import xml_translate
  4. class TestTranslationImportModel1(models.Model):
  5. _name = 'test.translation.import.model1'
  6. _description = 'Translation Test 1'
  7. name = fields.Char('Name', translate=True, help='Help, English')
  8. selection = fields.Selection([
  9. ('foo', 'Selection Foo'),
  10. ('bar', 'Selection Bar'),
  11. ])
  12. xml = fields.Text('XML', translate=xml_translate)
  13. def get_code_translation(self):
  14. _('slot') # a code translation for both python and js(static/src/xml/js_template.xml)
  15. return _('Code, English')
  16. def get_code_lazy_translation(self):
  17. return _lt('Code Lazy, English')
  18. def get_code_placeholder_translation(self, *args, **kwargs):
  19. return _('Code, %s, English', *args, **kwargs)
  20. def get_code_named_placeholder_translation(self, *args, **kwargs):
  21. return _('Code, %(num)s, %(symbol)s, English', *args, **kwargs)