Making WordPress.org


Ignore:
Timestamp:
09/16/2020 10:07:05 PM (5 years ago)
Author:
coreymckrill
Message:

WordPress.org Learn: Sync with GitHub

https://github.com/WordPress/learn/compare/41d65294a2e67cf35a5b799d179f2e6f53b58b48...fb8968a2cbd50fc4c1a8764586731e903577d3f3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/locales.php

    r10237 r10272  
    8282        return wp_list_pluck( $locales, 'english_name', 'wp_locale' );
    8383    }
     84
     85    /**
     86     * Get the name of a locale from the code.
     87     *
     88     * @param string $code      The locale code to look up. E.g. en_US.
     89     * @param string $name_type Optional. 'native' or 'english'. Default 'native'.
     90     *
     91     * @return mixed|string
     92     */
     93    function get_locale_name_from_code( $code, $name_type = 'native' ) {
     94        $function = __NAMESPACE__ . "\get_locales_with_{$name_type}_names";
     95        $locales  = $function();
     96
     97        return $locales[ $code ] ?? '';
     98    }
    8499}
Note: See TracChangeset for help on using the changeset viewer.