def get_translation_dict_from_file(path, lang, app):
 cleaned = {}
 if os.path.exists(path):
  csv_content = read_csv_file(path)
  for item in csv_content:
   if (len(item) == 3):
    cleaned[item[1]] = strip(item[2])
   elif (len(item) == 2):
    cleaned[item[0]] = strip(item[1])
   else:
    raise Exception(u"Bad translation in '{app}' for language '{lang}': {values}".format(app=app, lang=lang, values=repr(item).encode(u'utf-8')))
 return cleaned

def get_translation_dict_from_file ( path , lang , app ) : cleaned = { } if os . path . exists ( path ) : csv_content = read_csv_file ( path ) for item in csv_content : if ( len ( item ) == 3 ) : cleaned [ item [ 1 ] ] = strip ( item [ 2 ] ) elif ( len ( item ) == 2 ) : cleaned [ item [ 0 ] ] = strip ( item [ 1 ] ) else : raise Exception ( u"Bad translation in '{app}' for language '{lang}': {values}" . format ( app = app , lang = lang , values = repr ( item ) . encode ( u'utf-8' ) ) ) return cleaned
load translation dict from given path .