[MERGE] trunk
bzr revid: sle@openerp.com-20140408121101-ya7omkuobf5b8r6p
This commit is contained in:
commit
90422afbc9
|
@ -117,35 +117,37 @@ class base_gengo_translations(osv.osv_memory):
|
||||||
_logger.warning("%s", gengo)
|
_logger.warning("%s", gengo)
|
||||||
else:
|
else:
|
||||||
offset = 0
|
offset = 0
|
||||||
|
all_translation_ids = translation_pool.search(cr, uid, [('state', '=', 'inprogress'), ('gengo_translation', 'in', ('machine', 'standard', 'pro', 'ultra')), ('job_id', "!=", False)], context=context)
|
||||||
while True:
|
while True:
|
||||||
translation_ids = translation_pool.search(cr, uid, [('state', '=', 'inprogress'), ('gengo_translation', 'in', ('machine','standard','pro','ultra')), ('job_id', "!=",False)], limit=limit, offset=offset, context=context)
|
translation_ids = all_translation_ids[offset:offset + limit]
|
||||||
if not translation_ids:
|
if translation_ids:
|
||||||
|
offset += limit
|
||||||
|
translation_terms = translation_pool.browse(cr, uid, translation_ids, context=context)
|
||||||
|
gengo_job_id = [term.job_id for term in translation_terms]
|
||||||
|
if gengo_job_id:
|
||||||
|
gengo_ids = ','.join(gengo_job_id)
|
||||||
|
job_response = gengo.getTranslationJobBatch(id=gengo_ids)
|
||||||
|
if job_response['opstat'] == 'ok':
|
||||||
|
job_response_dict = dict([(job['job_id'], job) for job in job_response['response']['jobs']])
|
||||||
|
for term in translation_terms:
|
||||||
|
up_term = up_comment = 0
|
||||||
|
vals = {}
|
||||||
|
if job_response_dict[term.job_id]['status'] == 'approved':
|
||||||
|
vals.update({'state': 'translated',
|
||||||
|
'value': job_response_dict[term.job_id]['body_tgt']})
|
||||||
|
up_term += 1
|
||||||
|
job_comment = gengo.getTranslationJobComments(id=term.job_id)
|
||||||
|
if job_comment['opstat'] == 'ok':
|
||||||
|
gengo_comments = ""
|
||||||
|
for comment in job_comment['response']['thread']:
|
||||||
|
gengo_comments += _('%s\n-- Commented on %s by %s.\n\n') % (comment['body'], time.ctime(comment['ctime']), comment['author'])
|
||||||
|
vals.update({'gengo_comment': gengo_comments})
|
||||||
|
up_comment += 1
|
||||||
|
if vals:
|
||||||
|
translation_pool.write(cr, uid, term.id, vals)
|
||||||
|
_logger.info("Successfully Updated `%d` terms and %d Comments." % (up_term, up_comment))
|
||||||
|
if not len(translation_ids) == limit:
|
||||||
break
|
break
|
||||||
offset += limit
|
|
||||||
translation_terms = translation_pool.browse(cr, uid, translation_ids, context=context)
|
|
||||||
gengo_job_id = [term.job_id for term in translation_terms]
|
|
||||||
if gengo_job_id:
|
|
||||||
gengo_ids = ','.join(gengo_job_id)
|
|
||||||
job_response = gengo.getTranslationJobBatch(id=gengo_ids)
|
|
||||||
if job_response['opstat'] == 'ok':
|
|
||||||
job_response_dict = dict([(job['job_id'],job) for job in job_response['response']['jobs']])
|
|
||||||
for term in translation_terms:
|
|
||||||
up_term = up_comment = 0
|
|
||||||
vals={}
|
|
||||||
if job_response_dict[term.job_id]['status'] == 'approved':
|
|
||||||
vals.update({'state': 'translated',
|
|
||||||
'value': job_response_dict[term.job_id]['body_tgt']})
|
|
||||||
up_term += 1
|
|
||||||
job_comment = gengo.getTranslationJobComments(id=term.job_id)
|
|
||||||
if job_comment['opstat']=='ok':
|
|
||||||
gengo_comments=""
|
|
||||||
for comment in job_comment['response']['thread']:
|
|
||||||
gengo_comments += _('%s\n-- Commented on %s by %s.\n\n') % (comment['body'], time.ctime(comment['ctime']), comment['author'])
|
|
||||||
vals.update({'gengo_comment': gengo_comments})
|
|
||||||
up_comment += 1
|
|
||||||
if vals:
|
|
||||||
translation_pool.write(cr, uid, term.id, vals)
|
|
||||||
_logger.info("Successfully Updated `%d` terms and %d Comments." % (up_term, up_comment ))
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _update_terms(self, cr, uid, response, context=None):
|
def _update_terms(self, cr, uid, response, context=None):
|
||||||
|
@ -229,14 +231,15 @@ class base_gengo_translations(osv.osv_memory):
|
||||||
lang_ids = [context.get('gengo_language')]
|
lang_ids = [context.get('gengo_language')]
|
||||||
langs = [lang.code for lang in language_pool.browse(cr, uid, lang_ids, context=context)]
|
langs = [lang.code for lang in language_pool.browse(cr, uid, lang_ids, context=context)]
|
||||||
offset = 0
|
offset = 0
|
||||||
|
all_term_ids = translation_pool.search(cr, uid, [('state', '=', 'to_translate'), ('gengo_translation', 'in', ('machine', 'standard', 'pro', 'ultra')), ('lang', 'in', langs), ('job_id', "=", False)], context=context)
|
||||||
while True:
|
while True:
|
||||||
#search for the n first terms to translate
|
#search for the n first terms to translate
|
||||||
term_ids = translation_pool.search(cr, uid, [('state', '=', 'to_translate'), ('gengo_translation', 'in', ('machine','standard','pro','ultra')), ('lang', 'in', langs),('job_id',"=",False)], limit=limit, offset=offset, context=context)
|
term_ids = all_term_ids[offset:offset + limit]
|
||||||
if term_ids:
|
if term_ids:
|
||||||
self._send_translation_terms(cr, uid, term_ids, context=context)
|
|
||||||
offset += limit
|
offset += limit
|
||||||
|
self._send_translation_terms(cr, uid, term_ids, context=context)
|
||||||
_logger.info("%s Translation terms have been posted to Gengo successfully", len(term_ids))
|
_logger.info("%s Translation terms have been posted to Gengo successfully", len(term_ids))
|
||||||
else:
|
if not len(term_ids) == limit:
|
||||||
break
|
break
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
_logger.error("%s", e)
|
_logger.error("%s", e)
|
||||||
|
|
|
@ -7,14 +7,14 @@ msgstr ""
|
||||||
"Project-Id-Version: OpenERP Server 6.0dev_rc3\n"
|
"Project-Id-Version: OpenERP Server 6.0dev_rc3\n"
|
||||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||||
"POT-Creation-Date: 2012-12-21 17:06+0000\n"
|
"POT-Creation-Date: 2012-12-21 17:06+0000\n"
|
||||||
"PO-Revision-Date: 2012-12-16 19:25+0000\n"
|
"PO-Revision-Date: 2014-04-07 13:25+0000\n"
|
||||||
"Last-Translator: Grzegorz Grzelak (OpenGLOBE.pl) <grzegorz@openglobe.pl>\n"
|
"Last-Translator: Dariusz Żbikowski (Krokus) <darek@krokus.com.pl>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"X-Launchpad-Export-Date: 2014-03-27 06:41+0000\n"
|
"X-Launchpad-Export-Date: 2014-04-08 06:18+0000\n"
|
||||||
"X-Generator: Launchpad (build 16967)\n"
|
"X-Generator: Launchpad (build 16976)\n"
|
||||||
|
|
||||||
#. module: product
|
#. module: product
|
||||||
#: field:product.packaging,rows:0
|
#: field:product.packaging,rows:0
|
||||||
|
@ -735,7 +735,7 @@ msgstr "Jeśli zaznaczone, to wiadomość wymaga twojej uwagi"
|
||||||
#. module: product
|
#. module: product
|
||||||
#: field:product.product,ean13:0
|
#: field:product.product,ean13:0
|
||||||
msgid "EAN13 Barcode"
|
msgid "EAN13 Barcode"
|
||||||
msgstr ""
|
msgstr "Kod kreskowy EAN13"
|
||||||
|
|
||||||
#. module: product
|
#. module: product
|
||||||
#: model:ir.actions.act_window,name:product.action_product_price_list
|
#: model:ir.actions.act_window,name:product.action_product_price_list
|
||||||
|
@ -1188,7 +1188,7 @@ msgstr "Wiadomości i historia komunikacji"
|
||||||
#. module: product
|
#. module: product
|
||||||
#: model:product.uom,name:product.product_uom_kgm
|
#: model:product.uom,name:product.product_uom_kgm
|
||||||
msgid "kg"
|
msgid "kg"
|
||||||
msgstr ""
|
msgstr "kg"
|
||||||
|
|
||||||
#. module: product
|
#. module: product
|
||||||
#: selection:product.template,state:0
|
#: selection:product.template,state:0
|
||||||
|
@ -1198,7 +1198,7 @@ msgstr "Zdezaktualizowany"
|
||||||
#. module: product
|
#. module: product
|
||||||
#: model:product.uom,name:product.product_uom_km
|
#: model:product.uom,name:product.product_uom_km
|
||||||
msgid "km"
|
msgid "km"
|
||||||
msgstr ""
|
msgstr "km"
|
||||||
|
|
||||||
#. module: product
|
#. module: product
|
||||||
#: field:product.template,standard_price:0
|
#: field:product.template,standard_price:0
|
||||||
|
@ -1354,6 +1354,8 @@ msgid ""
|
||||||
"This field holds the image used as image for the product, limited to "
|
"This field holds the image used as image for the product, limited to "
|
||||||
"1024x1024px."
|
"1024x1024px."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"To pole utrzymuje obraz użyty jako zdjęcie produktu, limitowany rozmiar "
|
||||||
|
"1024x1024."
|
||||||
|
|
||||||
#. module: product
|
#. module: product
|
||||||
#: help:product.pricelist.item,categ_id:0
|
#: help:product.pricelist.item,categ_id:0
|
||||||
|
@ -1519,7 +1521,7 @@ msgstr ""
|
||||||
#. module: product
|
#. module: product
|
||||||
#: model:product.uom,name:product.product_uom_cm
|
#: model:product.uom,name:product.product_uom_cm
|
||||||
msgid "cm"
|
msgid "cm"
|
||||||
msgstr ""
|
msgstr "cm"
|
||||||
|
|
||||||
#. module: product
|
#. module: product
|
||||||
#: model:ir.model,name:product.model_product_uom
|
#: model:ir.model,name:product.model_product_uom
|
||||||
|
|
|
@ -7,13 +7,13 @@ msgstr ""
|
||||||
"Project-Id-Version: OpenERP Server 6.0dev\n"
|
"Project-Id-Version: OpenERP Server 6.0dev\n"
|
||||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||||
"POT-Creation-Date: 2012-12-21 17:04+0000\n"
|
"POT-Creation-Date: 2012-12-21 17:04+0000\n"
|
||||||
"PO-Revision-Date: 2014-04-04 19:47+0000\n"
|
"PO-Revision-Date: 2014-04-07 13:08+0000\n"
|
||||||
"Last-Translator: Dariusz Żbikowski <Unknown>\n"
|
"Last-Translator: Dariusz Żbikowski (Krokus) <darek@krokus.com.pl>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"X-Launchpad-Export-Date: 2014-04-05 05:30+0000\n"
|
"X-Launchpad-Export-Date: 2014-04-08 06:18+0000\n"
|
||||||
"X-Generator: Launchpad (build 16976)\n"
|
"X-Generator: Launchpad (build 16976)\n"
|
||||||
|
|
||||||
#. module: stock
|
#. module: stock
|
||||||
|
@ -2623,7 +2623,7 @@ msgstr "Ustaw na projekt"
|
||||||
#: model:ir.actions.act_window,name:stock.action_stock_journal_form
|
#: model:ir.actions.act_window,name:stock.action_stock_journal_form
|
||||||
#: model:ir.ui.menu,name:stock.menu_action_stock_journal_form
|
#: model:ir.ui.menu,name:stock.menu_action_stock_journal_form
|
||||||
msgid "Stock Journals"
|
msgid "Stock Journals"
|
||||||
msgstr "Dzienniki mogazynowe"
|
msgstr "Dzienniki magazynowe"
|
||||||
|
|
||||||
#. module: stock
|
#. module: stock
|
||||||
#: view:product.product:0
|
#: view:product.product:0
|
||||||
|
|
Loading…
Reference in New Issue