WordPress.org

Make WordPress Core

Ticket #30049: 30049.diff

File 30049.diff, 556 bytes (added by soulseekah, 16 months ago)

HTTP_ACCEPT_LANGUAGE

  • src/wp-includes/load.php

    diff --git src/wp-includes/load.php src/wp-includes/load.php
    index 81014fd..b93d44c 100644
    function wp_load_translations_early() { 
    974974                        $locales[] = $wp_local_package;
    975975                }
    976976
     977                // Try the browser's locale
     978                if ( ! empty( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ) {
     979                        if ( preg_match( '#[a-z]{2,3}-[a-zA-Z0-9-]+#', trim( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ), $matches ) ) {
     980                                $locales[] = str_replace( '-', '_', $matches[0] );
     981                        }
     982                }
     983
    977984                if ( ! $locales ) {
    978985                        break;
    979986                }