WordPress/wp-includes/js/api-request.min.js
TimothyBlynJacobs c3b40f7f80 Site Health, App Passwords: Ensure REST API responses are properly translated.
The REST API requests in Site Health and App Passwords now include `_locale=user` in the request URL to ensure the user's locale is used instead of the site locale. Additionally, the `apiRequest` library now sends a JSON `Accept` header which is required by `determine_locale()` to respect the `_locale` query parameter.

The Site Health REST API controllers now manually load the default admin textdomain if not `is_admin()`. This allows for the Site Health tests to be translated even though the translations are part of the administration project and the REST API is not.

Props oglekler, kebbet, Clorith, TimothyBlynJacobs, ocean90, SergeyBiryukov, adamsilverstein.
Fixes #51871.

Built from https://develop.svn.wordpress.org/trunk@49716


git-svn-id: http://core.svn.wordpress.org/trunk@49439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-01 03:44:05 +00:00

2 lines
1.0 KiB
JavaScript

/*! This file is auto-generated */
!function(w){var l=window.wpApiSettings;function t(e){return e=t.buildAjaxOptions(e),t.transport(e)}t.buildAjaxOptions=function(e){var t,n,a,p,o,r,i,d=e.url,s=e.path,c=e.method;for(i in"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(t=e.namespace.replace(/^\/|\/$/g,""),s=(n=e.endpoint.replace(/^\//,""))?t+"/"+n:t),"string"==typeof s&&(a=l.root,s=s.replace(/^\//,""),"string"==typeof a&&-1!==a.indexOf("?")&&(s=s.replace("?","&")),d=a+s),o=!(e.data&&e.data._wpnonce),r=!0,p=e.headers||{})if(p.hasOwnProperty(i))switch(i.toLowerCase()){case"x-wp-nonce":o=!1;break;case"accept":r=!1}return o&&(p=w.extend({"X-WP-Nonce":l.nonce},p)),r&&(p=w.extend({Accept:"application/json, */*;q=0.1"},p)),"string"==typeof c&&("PUT"!==(c=c.toUpperCase())&&"DELETE"!==c||(p=w.extend({"X-HTTP-Method-Override":c},p),c="POST")),delete(e=w.extend({},e,{headers:p,url:d,method:c})).path,delete e.namespace,delete e.endpoint,e},t.transport=w.ajax,window.wp=window.wp||{},window.wp.apiRequest=t}(jQuery);