def cache_translations_for_tree(root_objects, languages=None):
 all_objects = {}
 def walk(object_list):
  for object in object_list:
   all_objects[object.pk] = object
   walk(object.get_children())
 walk(root_objects)
 cache_translations(list(all_objects.values()), languages=languages)

def cache_translations_for_tree ( root_objects , languages = None ) : all_objects = { } def walk ( object_list ) : for object in object_list : all_objects [ object . pk ] = object walk ( object . get_children ( ) ) walk ( root_objects ) cache_translations ( list ( all_objects . values ( ) ) , languages = languages )
cache translation objects in given languages .