- if string_search is not None:
- for xmlfile in xmlfiles:
- if not os.path.isfile(xmlfile):
- continue
- for line in file(xmlfile):
- matches = string_search(line)
- if matches:
- return retrieve_string(app_dir, matches.group(1), xmlfiles)
- return None
+ name = string[len('@string/'):]
+
+ for path in xmlfiles:
+ if not os.path.isfile(path):
+ continue
+ xml = parse_xml(path)
+ element = xml.find('string[@name="'+name+'"]')
+ if element is not None:
+ return retrieve_string(app_dir, element.text, xmlfiles)