def sync_language(d, data):
 for key in data:
  if (key not in d):
   d[key] = data[key]
  elif (((d[key] != '') or (d[key] != key)) and ((data[key] == '') or (data[key] == key))):
   d[key] = d[key]
  else:
   d[key] = data[key]
 return d

def sync_language ( d , data ) : for key in data : if ( key not in d ) : d [ key ] = data [ key ] elif ( ( ( d [ key ] != '' ) or ( d [ key ] != key ) ) and ( ( data [ key ] == '' ) or ( data [ key ] == key ) ) ) : d [ key ] = d [ key ] else : d [ key ] = data [ key ] return d
this function makes sure a translated string will be prefered over an untranslated string when syncing languages between apps .