Commit Graph

233 Commits

Author SHA1 Message Date
Pascal Birchler ba19b8412d I18N: Change how `WP_Textdomain_Registry` stores the default languages path.
`WP_Textdomain_Registry` was introduced in [53874] to store text domains and their language directory paths, addressing issues with just-in-time loading of textdomains when using locale switching and when using`load_*_textdomain()` functions.

Said change has inadvertently caused a performance regression exactly when using`load_*_textdomain()`, which still often is the case, where the cached information was not further used or even overridden.

This change addresses that issue by storing the default languages paths in a separate way, while at the same time making `WP_Textdomain_Registry` easier to maintain and adding new tests to catch future regressions.

Props flixos90, spacedmonkey, ocean90, SergeyBiryukov, costdev.
Fixes #39210.
Built from https://develop.svn.wordpress.org/trunk@54669


git-svn-id: http://core.svn.wordpress.org/trunk@54221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-24 10:02:16 +00:00
Sergey Biryukov 70f3a062db I18N: Use correct default value for JavaScript translations path.
The `$path` parameter of some script translation functions had a default value of `null`, even though the parameter is documented as a string.

This commit corrects the default value for `$path` in:
* `WP_Dependency::set_translations()`
* `WP_Scripts::set_translations()`
* `wp_set_script_translations()`

Additionally, this commit removes an `is_string()` check for `$path` in `load_script_textdomain()`. Now that the default value for `$path` in that function has also been corrected to an empty string instead of `null`, that check is no longer necessary, as it would ''hide'' an error which should be ''fixed'' (at the source of the problem) instead.

Follow-up to [54349].

Props jrf, johnjamesjacoby.
See #55967, #55656.
Built from https://develop.svn.wordpress.org/trunk@54351


git-svn-id: http://core.svn.wordpress.org/trunk@53910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 22:19:10 +00:00
Sergey Biryukov d3006e8a16 Code Modernization: Use correct default value for JavaScript translations path.
The `$path` parameter of `load_script_textdomain()` had a default value of `null`, but would be passed onto the `untrailingslashit()` function without any input validation, even though the latter explicitly only expects/supports a string input.

This commit changes the default value for `$path` to an empty string, and adds an `is_string()` check before passing the value to `untrailingslashit()` to fix the issue at the point where the invalid input is incorrectly (not) validated.

Note: Changing the `untrailingslashit()` function is outside the scope of this commit.

Includes:
* Adding a dedicated unit test for this issue.
* Correcting the default value for `$path` from `null` to an empty string in a few related methods and functions:
 * `WP_Dependency::set_translations()`
 * `WP_Scripts::set_translations()`
 * `wp_set_script_translations()`
 * `load_script_textdomain()`

This fix also allows to remove a couple of calls to `expectDeprecation()` in unrelated tests.

Fixes an error when running the test suite:
{{{
4) Tests_Dependencies_Scripts::test_wp_external_wp_i18n_print_order
rtrim(): Passing null to parameter #1 ($string) of type string is deprecated

/var/www/src/wp-includes/formatting.php:2782
/var/www/src/wp-includes/l10n.php:1068
/var/www/src/wp-includes/class.wp-scripts.php:605
/var/www/src/wp-includes/class.wp-scripts.php:320
/var/www/src/wp-includes/class.wp-dependencies.php:136
/var/www/src/wp-includes/functions.wp-scripts.php:109
/var/www/tests/phpunit/tests/dependencies/scripts.php:1505
/var/www/tests/phpunit/includes/utils.php:436
/var/www/tests/phpunit/tests/dependencies/scripts.php:1507
/var/www/vendor/bin/phpunit:123
}}}

Follow-up to [44169], [44607], [51968].

Props jrf, ocean90, Chouby, swissspidy, lovor, iviweb, meysamnorouzi, DarkoG, oneearth27, SergeyBiryukov.
Fixes #55967. See #55656.
Built from https://develop.svn.wordpress.org/trunk@54349


git-svn-id: http://core.svn.wordpress.org/trunk@53908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 17:33:18 +00:00
desrosj 1966addc05 Coding Standards: Various alignment fixes from `composer format`.
Follow up to [53874], [54097], [54110], [54155], [54162], [54184].

See #39210, #55443, #56288, #56092, #56408, #56467, #55881.
Built from https://develop.svn.wordpress.org/trunk@54210


git-svn-id: http://core.svn.wordpress.org/trunk@53769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 19:51:09 +00:00
audrasjb c279ba3edb Docs: Typo correction in `_load_textdomain_just_in_time()` docblock.
Props kebbet.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 08:44:10 +00:00
Pascal Birchler bb9f57429a I18N: Introduce `WP_Textdomain_Registry` to store text domains and their language directory paths.
Previously, when using `switch_to_locale()` all current loaded text domains were unloaded and added to the `$l10n_unloaded` global. This prevented the just-in-time loading for text domains after a switch. The just-in-time loading was also only possible if the translations were stored in `WP_LANG_DIR`. Both issues have been fixed.

* Adds `WP_Textdomain_Registry` to keep track of the language directory paths for all plugins and themes.
* Updates all `load_*_textdomain()`  functions to store the path in `WP_Textdomain_Registry`.
* Adds `$locale` parameter to `load_textdomain()` to specify the locale the translation file is for.
* Adds `$reloadable` parameter to `unload_textdomain()` to define whether a text domain can be loaded just-in-time again. This is used by `WP_Locale_Switcher::load_translations()`.
* Extends `_load_textdomain_just_in_time()` to also support text domains of plugins and themes with custom language directories.
* Fixes the incorrect `test_plugin_translation_after_switching_locale_twice()` test which should have caught this issue earlier.
* Adds a new test plugin and theme to test the loading of translations with a custom language directory.
* Deprecates the now unused and private `_get_path_to_translation()` and `_get_path_to_translation_from_lang_dir()` functions.

Previously added in [49236] and reverted in [49236] to investigate concerns which are now addressed here.

Props yoavf, swissspidy, dd32, ocean90.
See #26511.
Fixes #39210.
Built from https://develop.svn.wordpress.org/trunk@53874


git-svn-id: http://core.svn.wordpress.org/trunk@53433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 12:39:12 +00:00
Sergey Biryukov 0eb9abd1fe Coding Standards: Rename the `$user_id` parameter of `get_user_locale()` to `$user` for accuracy.
Since the parameter accepts not only a user's ID, but also a `WP_User` object, `$user` is a more appropriate name, which better aligns with the `$post` parameter of functions that accept a post ID or a `WP_Post` object.

The pre-existing internal `$user` variable which contained a `WP_User` object is renamed to `$user_object` for clarity.

Follow-up to [38955].

Props aristath, poena, afercia, SergeyBiryukov.
See #55647.
Built from https://develop.svn.wordpress.org/trunk@53702


git-svn-id: http://core.svn.wordpress.org/trunk@53261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-15 13:45:11 +00:00
Sergey Biryukov a5cc224b3c Docs: Correct the type of the `$number` parameter in `ngettext*` filters.
This applies to:
* `ngettext`
* `ngettext_{$domain}`
* `ngettext_with_context`
* `ngettext_with_context_{$domain}`

Follow-up to [25565], [48136].

Props cyrillbolliger.
Fixes #56187.
Built from https://develop.svn.wordpress.org/trunk@53691


git-svn-id: http://core.svn.wordpress.org/trunk@53250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-10 00:07:16 +00:00
John Blackbourn 721877d3d2 I18N: Correct and improve inline docs and tests for functionality related to nooped plurals.
See #55646, #55652

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


git-svn-id: http://core.svn.wordpress.org/trunk@53132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 22:57:16 +00:00
audrasjb 20c003e842 Docs: Use third-person singular verbs for function descriptions in the `Core Translation` API.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 05:18:13 +00:00
Sergey Biryukov 9fb5112732 Docs: Add missing description for `$pagenow` global in various functions.
See #54729, #55499.
Built from https://develop.svn.wordpress.org/trunk@53060


git-svn-id: http://core.svn.wordpress.org/trunk@52649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-04 18:26:06 +00:00
Sergey Biryukov 0d747500ba I18N: Move `wp_get_list_item_separator()` to a more appropriate place.
Follow-up to [52929].

See #39733.
Built from https://develop.svn.wordpress.org/trunk@52933


git-svn-id: http://core.svn.wordpress.org/trunk@52522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-14 18:01:02 +00:00
audrasjb ea138fdcb9 Docs: Typo correction in `wp_dropdown_languages()` DocBlock.
Follow-up to [52058].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-20 22:26:02 +00:00
John Blackbourn 39bff93b6b Docs: Various inline documentation corrections and improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 12:20:02 +00:00
desrosj c86f41d98b Coding Standards: Minor alignment fix after [52058].
See #52058.
Built from https://develop.svn.wordpress.org/trunk@52078


git-svn-id: http://core.svn.wordpress.org/trunk@51670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 18:51:02 +00:00
joedolson d00b86ff06 I18N: Add language switcher on login/registration screens.
Load a language switcher on the login and registration screens that allows users to choose any already-installed language. Set user locale on registration.

Props johnbillion, Nikschavan, afercia, sabernhardt, garrett-eclipse, keyur5, paaljoachim, Clorith, tobifjellner.
Fixes #43700.
Built from https://develop.svn.wordpress.org/trunk@52058


git-svn-id: http://core.svn.wordpress.org/trunk@51650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 22:37:59 +00:00
John Blackbourn ae9eae8f64 Docs: Document some more common names for dynamic hooks and standardise the phrasing used.
Fixes #53581

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


git-svn-id: http://core.svn.wordpress.org/trunk@51444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-21 18:21:00 +00:00
gziolo 2f6eb9d25e Blocks: Add support for `variations in `block.json` file
We integrated variations with block types and the corresponding REST API endpoint in #52688. It's a follow-up patch to add missing support to the `block.json` metadata file when using `register_block_type`.

Some fields for variations are translatable.Therefore, i18n schema was copied over from Gutenberg: https://github.com/WordPress/gutenberg/blob/trunk/packages/blocks/src/api/i18n-block.json. The accompanying implementation was adapted as `translate_settings_using_i18n_schema`.

Props: gwwar, swissspidy, schlessera, jorgefilipecosta.
Fixes #53238.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-11 09:08:01 +00:00
John Blackbourn 79685db062 Docs: Corrections and improvements to types used in docblocks for symbols, properties, and filters.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:02:57 +00:00
Sergey Biryukov 5c663524c2 Docs: In various `@return` tags, list the expected type first, instead of `false`.
Follow-up to [46696], [47060], [49926], [49927], [49929].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49963


git-svn-id: http://core.svn.wordpress.org/trunk@49664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-15 20:08:07 +00:00
John Blackbourn b59c0f307b Docs: Corrections and improvements to types used in various docblocks.
See #51800, #52217

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


git-svn-id: http://core.svn.wordpress.org/trunk@49635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-05 17:16:11 +00:00
Sergey Biryukov 1d3fd41977 Docs: Move `locale` filter documentation to the canonical place.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@49859


git-svn-id: http://core.svn.wordpress.org/trunk@49578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-21 18:27:04 +00:00
Sergey Biryukov 700c9455ab I18N: Avoid PHP notices for relative URLs in `load_script_textdomain()`.
Props hellofromTonya, SeBsZ, archon810, nourma, justinahinon, SergeyBiryukov.
Fixes #49145.
Built from https://develop.svn.wordpress.org/trunk@49639


git-svn-id: http://core.svn.wordpress.org/trunk@49377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-17 20:52:09 +00:00
Dominik Schilling abc9d961d5 I18N: Revert [49236] for now to investigate alternative implementations.
See #39210, #51678, #26511.
Built from https://develop.svn.wordpress.org/trunk@49566


git-svn-id: http://core.svn.wordpress.org/trunk@49304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-12 14:43:09 +00:00
Dominik Schilling 173b9aa122 I18N: Introduce `WP_Textdomain_Registry` to store text domains and their language directory paths.
Previously, when using `switch_to_locale()` all current loaded text domains were unloaded and added to the `$l10n_unloaded` global. This prevented the just-in-time loading for text domains after a switch. The just-in-time loading was also only possible if the translations were stored in `WP_LANG_DIR`. Both issues have been fixed.

* Adds `WP_Textdomain_Registry` to keep track of the language directory paths for all plugins and themes.
* Updates all `load_*_textdomain()`  functions to store the path in `WP_Textdomain_Registry`.
* Adds `$reloadable` parameter to `unload_textdomain()` to define whether a text domain can be loaded just-in-time again. This is used by `WP_Locale_Switcher::load_translations()`.
* Extends `_load_textdomain_just_in_time()` to also support text domains of plugins and themes with custom language directories.
* Fixes the incorrect `test_plugin_translation_after_switching_locale_twice()` test which should have catch this issue earlier.
* Adds a new test plugin/theme to test the loading of translations with a custom language directory.
* Deprecates the now unused and private `_get_path_to_translation()` and `_get_path_to_translation_from_lang_dir()` functions.

Props yoavf, swissspidy, dd32, ocean90.
See #26511.
Fixes #39210.
Built from https://develop.svn.wordpress.org/trunk@49236


git-svn-id: http://core.svn.wordpress.org/trunk@48998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 16:05:07 +00:00
Sergey Biryukov 0e3147c40e Coding Standards: Replace alias PHP functions with the canonical names.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@49193


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-18 17:27:06 +00:00
Sergey Biryukov 69d46b2003 I18N: Use underscores instead of dashes and interpolation instead of concatenation in domain-specific gettext hooks, per the coding standards:
* `gettext_{$domain}`
* `gettext_with_context_{$domain}`
* `ngettext_{$domain}`
* `ngettext_with_context_{$domain}`

Additionally:
* Pass `$domain` parameter to the new hooks, for consistency with their pre-existing counterparts.
* Update documentation to explain the dynamic portion of the filter, for consistency with other dynamic hooks in core.

Follow-up to [48131].

Props swissspidy, knutsp, TimothyBlynJacobs, SergeyBiryukov.
Fixes #49518.
Built from https://develop.svn.wordpress.org/trunk@48136


git-svn-id: http://core.svn.wordpress.org/trunk@47905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-23 10:02:10 +00:00
whyisjake 98fc60aabe I18N: Introduce domain specific i18n gettext hooks.
Adding context to allow for more specific targeting. New hooks:

* `gettext-{$domain}`
* `gettext_with_context-{$domain}`
* `ngettext-{$domain}`
* `ngettext_with_context-{$domain}`

Fixes #49518.

Props geminilabs, garrett-eclipse, davidbaumwald, johnbillion, whyisjake.



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


git-svn-id: http://core.svn.wordpress.org/trunk@47900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-23 04:43:10 +00:00
Sergey Biryukov b16368c268 Docs: Remove `@staticvar` tags from core.
The tag was supported in phpDocumentor 1.x, but is no longer supported in 2.x and 3.x.

Usage of static variables is considered an internal implementation detail and has no information value for someone reading the docs.

Props alishanvr, jrf.
Fixes #50426.
Built from https://develop.svn.wordpress.org/trunk@48109


git-svn-id: http://core.svn.wordpress.org/trunk@47878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:40:12 +00:00
Sergey Biryukov 38676936ba Coding Standards: Use strict type check for `in_array()` and `array_search()` where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47550


git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-05 03:02:11 +00:00
Sergey Biryukov 32edd58e4c Docs: Add descriptions for some globals:
* `$wp_version`
* `$wp_local_package`
* `$required_php_version`
* `$required_mysql_version`

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47230


git-svn-id: http://core.svn.wordpress.org/trunk@47030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-10 03:30:06 +00:00
Sergey Biryukov 641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
Sergey Biryukov 47ed56f38f Code Modernization: Replace `dirname( __FILE__ )` calls with `__DIR__` magic constant.
This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.

This commit also includes:

* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
 * `wp-admin/admin-header.php`
 * `wp-admin/admin-footer.php`
 * `wp-includes/version.php`

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.
Built from https://develop.svn.wordpress.org/trunk@47198


git-svn-id: http://core.svn.wordpress.org/trunk@46998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-06 06:33:11 +00:00
Sergey Biryukov c289bb59ac Docs: Improve documentation for `WP_Dependencies`, `WP_Scripts`, and `WP_Styles` methods.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47170


git-svn-id: http://core.svn.wordpress.org/trunk@46970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-03 00:19:03 +00:00
Sergey Biryukov dd4d98a368 Docs: In various `@return` tags, list the expected type first, instead of `false`.
Follow-up to [46696].

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47060


git-svn-id: http://core.svn.wordpress.org/trunk@46860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-11 18:32:05 +00:00
Sergey Biryukov 967f43a6cb Docs: Indicate that `load_script_textdomain_relative_path` filter value can be `false`.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47049


git-svn-id: http://core.svn.wordpress.org/trunk@46849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-08 00:27:04 +00:00
John Blackbourn f545bb3f63 Docs: Improve documentation of known return types, plus other docs fixes.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:23:02 +00:00
John Blackbourn c8f91f77ac Docs: Correct invalid hook docblocks.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-27 19:11:02 +00:00
Sergey Biryukov 552852d887 Docs: Improve documentation for `esc_attr_e()`, `esc_html_e()`, `esc_attr_x()`, `esc_html_x()`.
Props atachibana.
Fixes #48383.
Built from https://develop.svn.wordpress.org/trunk@46593


git-svn-id: http://core.svn.wordpress.org/trunk@46390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 17:30:03 +00:00
John Blackbourn e36d1bcbd8 Docs: Docblock corrections and improvements, mostly related to various `pre_*` filters.
See #47110

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


git-svn-id: http://core.svn.wordpress.org/trunk@46044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-21 17:41:57 +00:00
Sergey Biryukov 77a31e6875 Docs: Add missing description for `$wp_locale_switcher` global.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45738


git-svn-id: http://core.svn.wordpress.org/trunk@45549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:47:55 +00:00
Sergey Biryukov e0311b76c7 Docs: Add missing description for `$wp_locale` global.
Props mukesh27.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45737


git-svn-id: http://core.svn.wordpress.org/trunk@45548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:46:55 +00:00
Dominik Schilling 8059b362e8 I18N: Add support for custom `WP_PLUGIN_URL` in `load_script_textdomain()`.
Plugins may not be on the same host/path as the rest of the content. To support loading translations for this setup check if the script source matches `plugins_url()`.
Also fixes an undefined index notice when a custom content URL has no path.

Props odminstudios, ocean90.
Fixes #46336, #46387.
Built from https://develop.svn.wordpress.org/trunk@45685


git-svn-id: http://core.svn.wordpress.org/trunk@45496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-27 12:44:56 +00:00
Gary Pendergast 4803fc405e Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in `wp-includes`.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
Sergey Biryukov 355d5f9bb7 Docs: Correct `@param` type for `$deprecated` and `$plugin_rel_path` arguments of `load_plugin_textdomain()`.
Props sudar.
Fixes #43304.
Built from https://develop.svn.wordpress.org/trunk@45254


git-svn-id: http://core.svn.wordpress.org/trunk@45063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-19 14:21:53 +00:00
Dominik Schilling 24e2829eb9 I18N: Add `$domain` argument to `translate_user_role()`.
The text domain is optional and gets passed to `translate_with_gettext_context()`.

Props johnjamesjacoby	.
Fixes #38736.
Built from https://develop.svn.wordpress.org/trunk@44830


git-svn-id: http://core.svn.wordpress.org/trunk@44662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-11 20:32:52 +00:00
Pascal Birchler a595f8a525 I18N: Add option to hide en_US locale in `wp_dropdown_languages()`.
Props danieltj for initial patch.
Fixes #44494.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-09 11:46:50 +00:00
Dominik Schilling 86e5a051db I18n: Expose JSON translation file paths in `load_script_textdomain()`.
Removes `file_exist()` checks before calling `load_script_translations()` to let the determined paths be passed to `load_script_translations()` which provides its own file check and the possibility to filter the path.

Props swissspidy, johnbillion, ocean90.
See #45769.
Built from https://develop.svn.wordpress.org/trunk@44418


git-svn-id: http://core.svn.wordpress.org/trunk@44248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-07 13:59:51 +00:00
Dominik Schilling f34e1dbad1 I18N: Make domain argument optional in `wp_set_script_translations()` / `WP_Scripts::set_translations()`.
Props swissspidy.
Fixes #45489.
Built from https://develop.svn.wordpress.org/trunk@44395


git-svn-id: http://core.svn.wordpress.org/trunk@44225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-04 21:12:50 +00:00
Sergey Biryukov 11c11199d9 i18n: Remove the `script_loader_src` filter from `load_script_textdomain()`.
This filter is superfluous here, the `load_script_textdomain_relative_path` should be used for customising the textdomain path.

Props dimadin.
Merges [44288] to trunk.
See #45528.
Built from https://develop.svn.wordpress.org/trunk@44318


git-svn-id: http://core.svn.wordpress.org/trunk@44148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 03:34:44 +00:00