Home | Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 # 4 # Copyright 2008, 2011 Zuza Software Foundation 5 # 6 # This file is part of translate. 7 # 8 # translate is free software; you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation; either version 2 of the License, or 11 # (at your option) any later version. 12 # 13 # translate is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with translate; if not, write to the Free Software 20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 22 # Original Author: Dan Schafer <dschafer@mozilla.com> 23 # Date: 10 Jun 2008 24 25 """A class to manage Mozilla .lang files.""" 26 27 from translate.storage import base 28 from translate.storage import txt 29 30 46 4749 """We extend TxtFile, since that has a lot of useful stuff for encoding""" 50 UnitClass = LangUnit 517653 #Have we just seen a ';' line, and so are ready for a translation 54 readyTrans = False 55 56 if not isinstance(lines, list): 57 lines = lines.split("\n") 58 for lineoffset, line in enumerate(lines): 59 line = line.rstrip("\n").rstrip("\r") 60 61 if len(line) == 0: #Skip blank lines 62 continue 63 64 if readyTrans: #If we are expecting a translation, set the target 65 u.target = line 66 readyTrans = False #We already have our translation 67 continue 68 69 if line.startswith(';'): 70 u = self.addsourceunit(line[1:]) 71 readyTrans = True # Now expecting a translation on the next line 72 u.addlocation("%s:%d" % (self.filename, lineoffset + 1))73
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Apr 12 18:12:03 2011 | http://epydoc.sourceforge.net |