'This scheduler will send a job request to the gengo , which terms are
waiing to be translated and for which gengo_translation is enabled.
A special key \'gengo_language\' can be passed in the context in order to
request only translations of that language only. Its value is the language
ID in Odoo.'

@api.model
def _sync_request(self, limit=GENGO_DEFAULT_LIMIT):

    domain = [('state', '=', 'to_translate'), ('gengo_translation', 'in', ('machine', 'standard', 'pro', 'ultra')), ('order_id', '=', False)]
    if self.env.context.get('gengo_language', False):
        lc = self.env['res.lang'].browse(self.env.context['gengo_language']).code
        domain.append(('lang', '=', lc))
    all_term_ids = self.env['ir.translation'].search(domain)
    try:
        offset = 0
        while True:
            term_ids = all_term_ids[offset:(offset + limit)]
            if term_ids:
                offset += limit
                self._send_translation_terms(term_ids)
                _logger.info('%s    Translation    terms    have    been    posted    to    Gengo    successfully', len(term_ids))
            if (not (len(term_ids) == limit)):
                break
    except Exception as e:
        _logger.error('%s', e)
