37""" returns languages id list """
+ 38result=[]
+ 39forlanguageinself.__xml.xml_xpath("/languages/language"):
+ 40result.append(language.id.strip())
+ 41returnresult
+
50""" returns the value for a specific language attribute name. It returns default if not found. """
+ 51forlanguageinself.__xml.xml_xpath("/languages/language[@id='%s']/%s"%(lid,name)):
+ 52returnlanguage.xml_child_text.strip()
+ 53returndefault
+
57""" Return the list of available fallbacks
+ 58 None if not any.
+ 59 """
+ 60string=self.get_attribute(lid,'fallbacks')
+ 61if(string!=None):
+ 62returnstring.split(',')
+ 63returnNone
+
66""" Find recursively the first reasonable alternative
+ 67 lid the language id
+ 68 exists an existance function that takes a language id
+ 69 as parameter and return a boolean
+ 70 """
+ 71
+ 72if(exists(lid)):
+ 73returnlid
+ 74
+ 75# get fallback list
+ 76fallbacks=self.get_fallbacks(lid)
+ 77iffallbacks==None:
+ 78returnNone
+ 79
+ 80forfallbackinfallbacks:
+ 81ifexists(fallback):
+ 82returnfallback
+ 83
+ 84forfallbackinfallbacks:
+ 85ffallback=self.find_first_fallback(fallback)
+ 86ifffallback!=None:
+ 87returnffallback
+ 88
+ 89returnNone
+
94""" Returns a list of all regional variations supported by platform. """
+ 95variations={'western':1}
+ 96xml=Languages(languages_xml)
+ 97forlidinxml.get_language_ids():
+ 98variations[xml.get_attribute(lid,'core','western')]=1
+ 99returnvariations.keys()
+
102""" Returns alist of all supported languages for a specific region. """
+103xml=Languages(languages_xml)
+104result=[]
+105forlidinxml.get_language_ids():
+106if(xml.get_attribute(lid,'core','western')==variation):
+107result.append(lid)
+108returnresult
+
214""" This function helps to find the variant directory
+215 using variant configuration
+216 """
+217ifconfig.has_key(VARIATION_DIR_KEY)andos.path.exists(config[VARIATION_DIR_KEY]):
+218fordirectoryinos.listdir(config[VARIATION_DIR_KEY]):
+219if(config.has_key(key)andre.match(r".*_%s$"%config[key],directory)!=None):
+220returnos.path.join(config[VARIATION_DIR_KEY],directory)
+221returnNone
+