Advertisement
Guest User

translang

a guest
Aug 25th, 2011
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. class translang:
  2.     __file = ""
  3.     __trans = 1
  4.     def __init__(self,lang,translate_n = 1):
  5.         self.__file = lang 
  6.         self.__trans = translate_n
  7.  
  8.     def translate(self,stringa):
  9.         rem = []
  10.         stop = 0
  11.         o = open(self.__file)
  12.         for line in o:
  13.             if line[0:7] == "_oldmsg" or line[0:7] == "_newmsg":
  14.                 line_mod = line.strip().replace("_oldmsg = ","").replace("_newmsg = ","").replace('"',"")
  15.                 if self.__trans == 1:
  16.                     if stop == 1:
  17.                         return line_mod
  18.                     elif stop == 0:
  19.                         if line_mod == stringa:
  20.                             stop = 1
  21.                 else:
  22.                     rem.append(line_mod)
  23.                     if line_mod == stringa:
  24.                         return rem[len(rem)-2]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement