protected static function createName(\SimpleXMLElement $currency)
    {
        $locale = self::getLocale();
        //first - see if we have an exact locale match
        $nodes = $currency->xpath("name[@lang='{$locale}']");
        if (count($nodes) > 0) {
            return (string) $nodes[0];
        }

        //next, see if we have a name for the language part of the locale
        $lang = \locale_get_primary_language($locale());
        $nodes = $currency->xpath("name[@lang='{$lang}']");
        if (count($nodes) > 0) {
            return (string) $nodes[0];
        }

        //else default to using 'en'
        $nodes = $currency->xpath("name[@lang='en']");
        return (string) $nodes[0];
    }
protected static function createName(\SimpleXMLElement $currency)
    {
        $locale = self::getLocale();
        //first - see if we have an exact locale match
        $nodes = $currency->xpath("name[@lang='{$locale}']");
        if (count($nodes) > 0) {
            return (string) $nodes[0];
        }

        //next, see if we have a name for the language part of the locale
        $lang = \locale_get_primary_language($locale());
        $nodes = $currency->xpath("name[@lang='{$lang}']");
        if (count($nodes) > 0) {
            return (string) $nodes[0];
        }

        //else default to using 'en'
        $nodes = $currency->xpath("name[@lang='en']");
        return (string) $nodes[0];
    }
protected static function createName ( \ SimpleXMLElement $ currency ) { $ locale = self :: getLocale ( ) ; //first - see if we have an exact locale match $ nodes = $ currency -> xpath ( "name[@lang='{$locale}']" ) ; if ( count ( $ nodes ) > 0 ) { return ( string ) $ nodes [ 0 ] ; } //next, see if we have a name for the language part of the locale $ lang = \ locale_get_primary_language ( $ locale ( ) ) ; $ nodes = $ currency -> xpath ( "name[@lang='{$lang}']" ) ; if ( count ( $ nodes ) > 0 ) { return ( string ) $ nodes [ 0 ] ; } //else default to using 'en' $ nodes = $ currency -> xpath ( "name[@lang='en']" ) ; return ( string ) $ nodes [ 0 ] ; }
Find closest matching name for a currency based on currently set locale.
Default to 'en' entry if none more suitable found

@param \SimpleXMLElement $currency

@return string
Find closest matching name for a currency based on currently set locale . Default to en entry if none more suitable found