public static function translate_xml(\SimpleXMLElement $parent, \SimpleXMLElement $child, $ns = 'http://www.w3.org/XML/1998/namespace', $locale = null)
{
$use = null;
// Set the locale
if (!isset($locale)) {
$locale = self::$locale;
}
// Loop through the child elements
foreach ($child as $el) {
if (isset($el['lang']) && $el['lang'] == $locale) {
// If a translation for the element is found, use it instead of the default value
// Remove the lang attribute in memory to make it the default
unset($el['lang']);
}
}
}