Home | Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 # 4 # Copyright 2006-2007 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 23 """module for handling TBX glossary files""" 24 25 from translate.storage import lisa 26 from lxml import etree 2729 """A single term in the TBX file. 30 Provisional work is done to make several languages possible.""" 31 rootNode = "termEntry" 32 languageNode = "langSet" 33 textNode = "term" 3445 4636 """returns a langset xml Element setup with given parameters""" 37 if isinstance(text, str): 38 text = text.decode("utf-8") 39 langset = etree.Element(self.languageNode) 40 lisa.setXMLlang(langset, lang) 41 tig = etree.SubElement(langset, "tig") # or ntig with termGrp inside 42 term = etree.SubElement(tig, self.textNode) 43 term.text = text 44 return langset48 """Class representing a TBX file store.""" 49 UnitClass = tbxunit 50 Name = _("TBX Glossary") 51 Mimetypes = ["application/x-tbx"] 52 Extensions = ["tbx"] 53 rootNode = "martif" 54 bodyNode = "body" 55 XMLskeleton = '''<?xml version="1.0"?> 56 <!DOCTYPE martif PUBLIC "ISO 12200:1999A//DTD MARTIF core (DXFcdV04)//EN" "TBXcdv04.dtd"> 57 <martif type="TBX"> 58 <martifHeader> 59 <fileDesc> 60 <sourceDesc><p>Translate Toolkit - csv2tbx</p></sourceDesc> 61 </fileDesc> 62 </martifHeader> 63 <text><body></body></text> 64 </martif>''' 656967 """Initialise headers with TBX specific things.""" 68 lisa.setXMLlang(self.document.getroot(), self.sourcelanguage)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Oct 15 13:55:57 2009 | http://epydoc.sourceforge.net |