<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <tuple>
        <tuple>
          <string>Products.PythonScripts.PythonScript</string>
          <string>PythonScript</string>
        </tuple>
        <none/>
      </tuple>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>Python_magic</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>Script_magic</string> </key>
            <value> <int>3</int> </value>
        </item>
        <item>
            <key> <string>__ac_local_roles__</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_bind_names</string> </key>
            <value>
              <object>
                <klass>
                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>_asgns</string> </key>
                        <value>
                          <dictionary>
                            <item>
                                <key> <string>name_container</string> </key>
                                <value> <string>container</string> </value>
                            </item>
                            <item>
                                <key> <string>name_context</string> </key>
                                <value> <string>context</string> </value>
                            </item>
                            <item>
                                <key> <string>name_m_self</string> </key>
                                <value> <string>script</string> </value>
                            </item>
                            <item>
                                <key> <string>name_subpath</string> </key>
                                <value> <string>traverse_subpath</string> </value>
                            </item>
                          </dictionary>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>_body</string> </key>
            <value> <string>from Products.ERP5Type.Document import newTempBase\n
\n
supported_languages = context.Localizer.get_supported_languages()\n
translated_keys = {} # This dict prevents entering the same key twice\n
\n
context.portal_catalog.deleteTranslationList(sql_catalog_id=sql_catalog_id)\n
\n
i = 0\n
\n
# Translate every workflow state in the context of the state variable\n
for wf in context.portal_workflow.objectValues():\n
  object_list = []\n
  state_var = wf.variables.getStateVar()\n
  if wf.states:\n
    for state_id, state in wf.states.items():\n
      for lang in supported_languages:\n
        key = (lang, state_var, state_id)\n
        if not translated_keys.has_key(key):\n
          translated_keys[key] = None # mark as translated\n
          obj = newTempBase(context, \'temp_translation_%d\' % i,\n
                            language=lang, message_context=state_var, original_message=state_id,\n
                            translated_message = context.Localizer.erp5_ui.gettext(state_id, lang=lang).encode(\'utf-8\'))\n
          obj.setUid(\'temp_%d\' % i)\n
          i += 1\n
          object_list.append(obj)\n
\n
        # translate state title as well\n
        if state.title != \'\' :\n
          state_var_title = \'%s_title\' % state_var\n
          translated_message = context.Localizer.erp5_ui.gettext(state.title, lang=lang).encode(\'utf-8\')\n
          key = (lang, state_var_title, translated_message)\n
          if not translated_keys.has_key(key):\n
            translated_keys[key] = None # mark as translated\n
            obj = newTempBase(context, \'temp_translation_%d\' % i,\n
                              language=lang, message_context=state_var_title,\n
                              original_message = state_id, translated_message = translated_message )\n
            obj.setUid(\'temp_%d\' % i)\n
            i += 1\n
            object_list.append(obj)\n
\n
  if object_list:\n
    context.portal_catalog.catalogTranslationList(object_list, sql_catalog_id=sql_catalog_id)\n
\n
# Translate every portal type in the context of the portal type\n
for ptype in context.portal_types.objectValues():\n
  title = ptype.title\n
  if not title: title = ptype.id\n
  object_list = []\n
  for lang in supported_languages:\n
    key = (lang, \'portal_type\', title)\n
    if not translated_keys.has_key(key):\n
      translated_keys[key] = None # mark as translated\n
      obj = newTempBase(context, \'temp_translation_%d\' % i,\n
                        language=lang, message_context="portal_type",\n
                        original_message = title,\n
                        translated_message = context.Localizer.erp5_ui.gettext(title, lang=lang).encode(\'utf-8\'))\n
      obj.setUid(\'temp_%d\' % i)\n
      i += 1\n
      object_list.append(obj)\n
\n
  if object_list:\n
    context.portal_catalog.catalogTranslationList(object_list, sql_catalog_id=sql_catalog_id)\n
\n
print \'Done\'\n
return printed\n
</string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_filepath</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>sql_catalog_id=None</string> </value>
        </item>
        <item>
            <key> <string>errors</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
        <item>
            <key> <string>func_code</string> </key>
            <value>
              <object>
                <klass>
                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>co_argcount</string> </key>
                        <value> <int>1</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>sql_catalog_id</string>
                            <string>_print_</string>
                            <string>_print</string>
                            <string>Products.ERP5Type.Document</string>
                            <string>newTempBase</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>supported_languages</string>
                            <string>translated_keys</string>
                            <string>i</string>
                            <string>_getiter_</string>
                            <string>wf</string>
                            <string>object_list</string>
                            <string>state_var</string>
                            <string>state_id</string>
                            <string>state</string>
                            <string>lang</string>
                            <string>key</string>
                            <string>None</string>
                            <string>_write_</string>
                            <string>obj</string>
                            <string>state_var_title</string>
                            <string>translated_message</string>
                            <string>ptype</string>
                            <string>title</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <none/>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>ERP5Site_updateTranslationTable</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
