determine_locale example

/** * Loads the admin textdomain for Site Health tests. * * The {@see WP_Site_Health} class is defined in WP-Admin, while the REST API operates in a front-end context. * This means that the translations for Site Health won't be loaded by default in {@see load_default_textdomain()}. * * @since 5.6.0 */
    protected function load_admin_textdomain() {
        // Accounts for inner REST API requests in the admin.         if ( ! is_admin() ) {
            $locale = determine_locale();
            load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo", $locale );
        }
    }

    /** * Gets the schema for each site health test. * * @since 5.6.0 * * @return array The test schema. */
    
global $wp_version;
            $output = $wp_version;
            break;
        case 'language':
            /* * translators: Translate this to the correct language tag for your locale, * see https://www.w3.org/International/articles/language-tags/ for reference. * Do not translate into your own language. */
            $output = __( 'html_lang_attribute' );
            if ( 'html_lang_attribute' === $output || preg_match( '/[^a-zA-Z0-9-]/', $output ) ) {
                $output = determine_locale();
                $output = str_replace( '_', '-', $output );
            }
            break;
        case 'text_direction':
            _deprecated_argument(
                __FUNCTION__,
                '2.2.0',
                sprintf(
                    /* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name. */
                    __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ),
                    '<code>' . $show . '</code>',
                    
$scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.17', 1 );
    $scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.17', 1 );
    $scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1 );

    did_action( 'init' ) && $scripts->add_inline_script(
        'mediaelement-core',
        sprintf(
            'var mejsL10n = %s;',
            wp_json_encode(
                array(
                    'language' => strtolower( strtok( determine_locale(), '_-' ) ),
                    'strings'  => array(
                        'mejs.download-file'       => __( 'Download File' ),
                        'mejs.install-flash'       => __( 'You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/' ),
                        'mejs.fullscreen'          => __( 'Fullscreen' ),
                        'mejs.play'                => __( 'Play' ),
                        'mejs.pause'               => __( 'Pause' ),
                        'mejs.time-slider'         => __( 'Time Slider' ),
                        'mejs.time-help-text'      => __( 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' ),
                        'mejs.live-broadcast'      => __( 'Live Broadcast' ),
                        'mejs.volume-help-text'    => __( 'Use Up/Down Arrow keys to increase or decrease volume.' ),
                        'mejs.unmute'              => __( 'Unmute' ),
                        
<?php                             /* translators: Hidden accessibility text. */
                            _e( 'Language' );
                            ?> </span> </label> <?php                     $args = array(
                        'id'                          => 'language-switcher-locales',
                        'name'                        => 'wp_lang',
                        'selected'                    => determine_locale(),
                        'show_available_translations' => false,
                        'explicit_option_en_us'       => true,
                        'languages'                   => $languages,
                    );

                    /** * Filters default arguments for the Languages select input on the login screen. * * The arguments get passed to the wp_dropdown_languages() function. * * @since 5.9.0 * * @param array $args Arguments for the Languages select input on the login screen. */

    $mofile = apply_filters( 'load_textdomain_mofile', $mofile$domain );

    if ( ! is_readable( $mofile ) ) {
        return false;
    }

    if ( ! $locale ) {
        $locale = determine_locale();
    }

    $mo = new MO();
    if ( ! $mo->import_from_file( $mofile ) ) {
        $wp_textdomain_registry->set( $domain$locale, false );

        return false;
    }

    if ( isset( $l10n[ $domain ] ) ) {
        $mo->merge_with( $l10n[ $domain ] );
    }
WP_LANG_DIR . '/themes',
        );

        foreach ( $locations as $location ) {
            $mofiles = glob( $location . '/*.mo' );
            if ( $mofiles ) {
                $cached_mofiles = array_merge( $cached_mofiles$mofiles );
            }
        }
    }

    $locale = determine_locale();
    $mofile = "{$domain}-{$locale}.mo";

    $path = WP_LANG_DIR . '/plugins/' . $mofile;
    if ( in_array( $path$cached_mofiles, true ) ) {
        return $path;
    }

    $path = WP_LANG_DIR . '/themes/' . $mofile;
    if ( in_array( $path$cached_mofiles, true ) ) {
        return $path;
    }

    

    private $available_languages;

    /** * Constructor. * * Stores the original locale as well as a list of all available languages. * * @since 4.7.0 */
    public function __construct() {
        $this->original_locale     = determine_locale();
        $this->available_languages = array_merge( array( 'en_US' )get_available_languages() );
    }

    /** * Initializes the locale switcher. * * Hooks into the {@see 'locale'} and {@see 'determine_locale'} filters * to change the locale on the fly. * * @since 4.7.0 */
    
Home | Imprint | This part of the site doesn't use cookies.