INNER CODE UNIT · Python
get_base_strings
sameerasw/essentials · scripts/validate_strings.py:42
def get_base_strings(base_path):
"""Loads base strings from values/strings.xml into a dict: {key: (raw_val, placeholders)}"""
if not os.path.exists(base_path):
return {}
base_data = {}
try:
tree = ET.parse(base_path)
root = tree.getroot()
for elem in root.findall('string'):
name = elem.get('name')
if not name:
continue
# Get raw inner XML content
raw_text = (elem.text or "")
for child in elem:
raw_text += ET.tostring(child, encoding='unicode')
if elem.tail: