Commit Graph

146 Commits

Author SHA1 Message Date
Scott Taylor 6d87157eb9 i18n: move `is_rtl()` to `l10n.php` (which loads way earlier). Load `WP_Locale` file in `wp-settings.php`. Retire `wp-includes/locale.php` - it only loaded the class and the one function, `is_rtl()`. If someone loaded this file for fun somewhere else, it would be a fatal error.
See #37827.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 10:20:29 +00:00
Scott Taylor ac6c22c392 L10N: improve accuracy of docs.
Props johnbillion.
Fixes #37585.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 09:38:28 +00:00
Sergey Biryukov 83bed74a2f Docs: Fix typo in `load_plugin_textdomain()` parameter description.
Props tivnet.
See #37318.
Built from https://develop.svn.wordpress.org/trunk@38284


git-svn-id: http://core.svn.wordpress.org/trunk@38225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-19 14:29:30 +00:00
John Blackbourn dc3d64ed9c I18N: Correct the documented return types of `get_translations_for_domain()`.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@38139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-04 22:13:29 +00:00
Drew Jaynes 6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Sergey Biryukov 139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for `_doing_it_wrong()`, `_deprecated_function()`, `_deprecated_argument()`, and `_deprecated_file()` throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Jeremy Felt 6f3f00ea97 Multisite: Change `WP_Network` `id` property to an integer.
For consistency and developer sanity.

Props flixos90.
Fixes #37050.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 14:26:29 +00:00
Drew Jaynes 558d5b371c Docs: Standardize filter docs in wp-includes/l10n.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:48:28 +00:00
Dominik Schilling a673a71f94 I18N: In `get_translations_for_domain()` check if the global `$l10n` was set by `_load_textdomain_just_in_time()` before accessing it.
Props danielhuesken.
Fixes #34114.
Built from https://develop.svn.wordpress.org/trunk@37440


git-svn-id: http://core.svn.wordpress.org/trunk@37406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-16 15:10:29 +00:00
Pascal Birchler 64fb1a9e90 I18N: Add changes missed in [37415].
See #34114.
Built from https://develop.svn.wordpress.org/trunk@37416


git-svn-id: http://core.svn.wordpress.org/trunk@37382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-10 20:31:27 +00:00
Pascal Birchler 3f6966907b I18N: Reverse the order of loading plugin and theme translations.
`load_theme_textdomain()`, `load_plugin_textdomain()` and `load_muplugin_textdomain()` now try to load the .mo file from the `wp-content/languages` directory first. After the introduction of language packs, translation files are more likely to be located there.

Props swissspidy, sebastian.pisula.
Fixes #34213.
Built from https://develop.svn.wordpress.org/trunk@37414


git-svn-id: http://core.svn.wordpress.org/trunk@37380 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-10 18:50:27 +00:00
Drew Jaynes fe3b007fdd Docs: Remove inline `@see` tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Sergey Biryukov 7c2ad56158 Docs: Correct description for `override_load_textdomain` and `override_unload_textdomain` filters.
Props dimadin.
Fixes #36537.
Built from https://develop.svn.wordpress.org/trunk@37214


git-svn-id: http://core.svn.wordpress.org/trunk@37180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-15 17:19:28 +00:00
Sergey Biryukov bd4c250078 Docs: Correct `_n_noop()` and `_nx_noop()` descriptions to use third-person singular verbs.
Props realloc.
See #35961.
Built from https://develop.svn.wordpress.org/trunk@36765


git-svn-id: http://core.svn.wordpress.org/trunk@36732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-28 20:43:26 +00:00
Dominik Schilling 51473acfb3 i18n: Prevent `is_textdomain_loaded()` from returning true even if there are no translations for the domain.
In `get_translations_for_domain()` don't fill the global `$l10n` with `NOOP_Translations` instances, return a `NOOP_Translations` instance instead.

Props nacin, jrf.
Fixes #21319.
Built from https://develop.svn.wordpress.org/trunk@36538


git-svn-id: http://core.svn.wordpress.org/trunk@36505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-16 21:15:29 +00:00
John Blackbourn 045d7d3a18 I18N: Correct an argument description and return value for `wp_dropdown_languages()`.
Props realloc
See #35294

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


git-svn-id: http://core.svn.wordpress.org/trunk@36257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-13 20:33:25 +00:00
Drew Jaynes 9b89047bf2 Docs: Add a missing notation for the `$context` parameter in the DocBlock for `_nx_noop()`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-18 23:16:26 +00:00
Sergey Biryukov 6ffc7914f1 I18N: Add a unit test for `before_last_bar()`.
Props realloc.
Fixes #35073.
Built from https://develop.svn.wordpress.org/trunk@35959


git-svn-id: http://core.svn.wordpress.org/trunk@35923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-16 08:04:26 +00:00
Dominik Schilling 6fb81e3338 L10n: Use an absolute path for the `is_dir()` check when looking for installed translations.
Avoids warnings when `open_basedir` restrictions are in effect.

Props Profforg.
Fixes #34526.
Built from https://develop.svn.wordpress.org/trunk@35856


git-svn-id: http://core.svn.wordpress.org/trunk@35820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-10 23:09:27 +00:00
Jeremy Felt 9926983b66 Revert [34778], continue using `_site_option()` for the current network.
The `_network_option()` parameter order will be changing to accept `$network_id` first. The `_site_option()` functions will remain in use throughout core as our way of retrieving a network option for the current network.

See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 17:11:25 +00:00
Boone Gorges 0e7c1d3b14 Use `wp_installing()` instead of `WP_INSTALLING` constant.
The `WP_INSTALLING` constant is a flag that WordPress sets in a number of
places, telling the system that options should be fetched directly from the
database instead of from the cache, that WP should not ping wordpress.org for
updates, that the normal "not installed" checks should be bypassed, and so on.

A constant is generally necessary for this purpose, because the flag is
typically set before the WP bootstrap, meaning that WP functions are not yet
available.  However, it is possible - notably, during `wpmu_create_blog()` -
for the "installing" flag to be set after WP has already loaded. In these
cases, `WP_INSTALLING` would be set for the remainder of the process, since
there's no way to change a constant once it's defined. This, in turn, polluted
later function calls that ought to have been outside the scope of site
creation, particularly the non-caching of option data. The problem was
particularly evident in the case of the automated tests, where `WP_INSTALLING`
was set the first time a site was created, and remained set for the rest of the
suite.

The new `wp_installing()` function allows developers to fetch the current
installation status (when called without any arguments) or to set the
installation status (when called with a boolean `true` or `false`). Use of
the `WP_INSTALLING` constant is still supported; `wp_installing()` will default
to `true` if the constant is defined during the bootstrap.

Props boonebgorges, jeremyfelt.
See #31130.
Built from https://develop.svn.wordpress.org/trunk@34828


git-svn-id: http://core.svn.wordpress.org/trunk@34793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 15:06:28 +00:00
Drew Jaynes bfa2a5295e Docs: Improve a variety of inline docs in wp-includes/l10n.php.
* Corrects phrasing used in the descriptions for and filters in `_n()` and `_nx()`, particularly with regard to the use of 'singular' instead of 'single' or '1', and 'plural' instead of 'not 1'.
* Adds example usage to `_n()`, `_nx()`, `_nx_noop()`, and `translate_nooped_plural()`.
* Adds hash notation `@return` doc for `_n_noop()` and `_nx_noop()`.
* Adds missing default values for the optional `$domain` parameter in several places.

Props johnbillion.
Fixes #34127.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 20:45:24 +00:00
Jeremy Felt 54512d64cb MS: Use `*_network_option()` functions throughout core.
Replaces all uses of `*_site_option()` with the corresponding "network" function.

This excludes one usage in `wp-admin/admin-footer.php` that needs more investigation.

Props spacedmonkey.
See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 19:08:26 +00:00
Drew Jaynes e5e03e787c Docs: Link up a hook reference with an inline `@see` tag in the return description for `get_locale()`.
Missed in [34484].

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 05:51:23 +00:00
Drew Jaynes 81e135955a Docs: Fix the summary for `get_locale()`.
Also update the description to properly link up hook references with inline `@see` tags.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 05:50:24 +00:00
Drew Jaynes 1c761505b6 Docs: Clarify the file header summary for wp-includes/l10n.php and add the version it was introduced.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 05:47:24 +00:00
Drew Jaynes f64c19aa95 Docs: Split the DocBlock summary for `__()` into a summary and description.
Also, notate the default value for the optional `$domain` parameter.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 05:43:26 +00:00
Scott Taylor ef87172270 `foreach` is a statement, not a function.
See #33491.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 20:28:22 +00:00
Mark Jaquith 4965581097 Don't blindly trust the output of `glob()` to be an array.
props kitchin
fixes #33093
Built from https://develop.svn.wordpress.org/trunk@33447


git-svn-id: http://core.svn.wordpress.org/trunk@33414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-27 18:05:24 +00:00
Drew Jaynes 71a7b8c5a4 Remove now-unnecessary inline `@see` tag from the DocBlock for `wp_dropdown_languages()`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 21:42:24 +00:00
Dominik Schilling 699dbedb03 l10n: Update `wp_get_installed_translations()` to support variants of a language.
* A variant of a language has its own locale, for example the locale of the formal variant of German is `de_DE_formal`.
* Update `remove_accents()` and some CSS rules to support `de_DE_formal`.
* Add tests for `get_bloginfo( 'language' )`.
* API changes will be deployed over the next few days.

see #28303.
Built from https://develop.svn.wordpress.org/trunk@33027


git-svn-id: http://core.svn.wordpress.org/trunk@32998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-01 15:43:24 +00:00
Scott Taylor b9e8ee95b5 `prep_atom_text_construct()` and `before_last_bar()` should strictly check against `false` when using `str(r)?pos()`.
Sidenote: there's a function named `before_last_bar`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-25 16:49:25 +00:00
Scott Taylor 2787e0080a Add missing doc blocks to `l10n.php`
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-26 18:13:25 +00:00
Sergey Biryukov d40fe7d80b Allow `wp_dropdown_languages()` to return the markup instead of displaying.
props leewillis77, juliobox.
fixes #32432.
Built from https://develop.svn.wordpress.org/trunk@32510


git-svn-id: http://core.svn.wordpress.org/trunk@32480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-19 00:33:26 +00:00
Sergey Biryukov e2f5a8094e Avoid a PHP notice in `wp_install_language_form()` and `wp_dropdown_languages()` if the language doesn't have a ISO 639-1 code.
props barrykooij.
fixes #31319.
Built from https://develop.svn.wordpress.org/trunk@31447


git-svn-id: http://core.svn.wordpress.org/trunk@31428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-13 11:23:26 +00:00
Scott Taylor 60b0cd7943 The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Scott Taylor a0df295f5c Improve various `@param` docs.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 23:24:25 +00:00
Drew Jaynes b8c612ca1c Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
Affects DocBlocks for the following core elements:
* Markdown-indent a code snippet in the file header for wp-admin/install-helper.php
* Add markdown formatting and two inline `@see` tags to the description for `translate()`
* Markdown-indent a code snippet in the description for `_n_noop()`
* Remove HTML tags from the summary for `get_media_embedded_in_content()`
* Remove an HTML tag from the summary for `wpview_media_sandbox_styles()`

Props rarst.
See #30473.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 05:47:23 +00:00
John Blackbourn 3ace1fac81 Only output an optgroup for installed languages in `wp_dropdown_languages()` if translations are available.
See #30335

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


git-svn-id: http://core.svn.wordpress.org/trunk@30484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-21 03:20:22 +00:00
Drew Jaynes 51e7e8e695 Clarify/correct inline documentation in wp-includes/l10n.php.
* Add a missing `@return` description for `load_default_textdomain()`
* Clarify the `@param` description for `$locale` with an inline `@see` tag
* Ensure the correct parameter variable is used when documenting `$args` for `wp_dropdown_languages()`

Props camdensegal.
Fixes #30385.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-18 18:47:22 +00:00
Andrew Nacin b922be3f71 Only use the 'Installed' optgroup in wp_dropdown_languages() if it's needed.
see #30335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-14 03:24:23 +00:00
Dominik Schilling 8fb6f317ff Site Language: Install translations on the fly.
The language dropdown now includes installed languages and all available translations when the filesystem is writable by WordPress.
Go to wp-admin/options-general.php, select one of the available translations, submit the form and let WordPress handle the rest.
Works for Multisite's Default Language too.

see #29395.
Built from https://develop.svn.wordpress.org/trunk@30335


git-svn-id: http://core.svn.wordpress.org/trunk@30334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-13 17:01:24 +00:00
John Blackbourn ae7cb843a0 Avoid double path separators in `load_theme_textdomain()`. Fixes #29122. Props bradyvercher
Built from https://develop.svn.wordpress.org/trunk@29984


git-svn-id: http://core.svn.wordpress.org/trunk@29726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-21 17:58:18 +00:00
Dominik Schilling 57c41263d7 Language packs: Remove translations when deleting a theme or a plugin.
This is for translation files in WP_LANG_DIR which are installed through a language pack.
Change `wp_get_installed_translations()` to only return a translation if the .mo file also exists.

fixes #29860.
Built from https://develop.svn.wordpress.org/trunk@29856


git-svn-id: http://core.svn.wordpress.org/trunk@29619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-08 19:05:20 +00:00
Dominik Schilling d544610681 Language packs: No WPLANG anymore.
* The WPLANG constant is no longer needed. Remove define('WPLANG', ''); from wp-config-sample.php. Populate WPLANG option based on the WPLANG constant. When get_option('WPLANG') is an empty string it will override WPLANG.
* Introduce translations_api() which is available to communicate with the translation API. Move translation install related functions to a new file.
* Replace mu_dropdown_languages() with wp_dropdown_languages(). wp_dropdown_languages() is now populated by the translation API.
* Remove wp_install_load_language() and allow load_default_textdomain() to switch a core translation.

fixes #13069, #15677, #19760, #28730, #29281. 
Built from https://develop.svn.wordpress.org/trunk@29630


git-svn-id: http://core.svn.wordpress.org/trunk@29404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-26 19:59:16 +00:00
Drew Jaynes c5a59037f1 Inline documentation cleanup for 4.0 audit.
Various improvements:
* Adds `@see` reference for `wp_list_comments()` in 'wp_list_comments_args' filter docs, added in [28285]
* Various phpDoc tweaks for the 'run_wptexturize' filter docs, added in [28715]
* Sentence and wrapping changes for `is_https_url()`, added in [28894]
* Documents the `$args` parameter for `wp_dropdown_languages()`, added in [29007]
* Adds a period to the parameter description for `_update_posts_count_on_delete()`, added in [28835]
* Documents a global in `is_customize_preview()`, added in [28999]
* phpDoc tweaks, adds an access modifier for `wpdb::esc_like()`, added in [28711]

See #28885.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 01:02:15 +00:00
Andrew Nacin 4e2f1bd155 Introduce wp_dropdown_languages() and use it on general settings.
Early rough cut. Obviously not fully implemented.

see #15677.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-05 06:19:16 +00:00
Sergey Biryukov 575425ffbe Add @since for get_translations_for_domain().
props DrewAPicture.
see #28690.
Built from https://develop.svn.wordpress.org/trunk@28938


git-svn-id: http://core.svn.wordpress.org/trunk@28736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-01 15:29:13 +00:00
Sergey Biryukov 2752456493 Document @return value for load_plugin_textdomain(). props jdgrimes.
Document $path parameter for load_child_theme_textdomain().

fixes #28690.
Built from https://develop.svn.wordpress.org/trunk@28924


git-svn-id: http://core.svn.wordpress.org/trunk@28723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-30 13:52:15 +00:00
Andrew Nacin c504fb41a1 Allow a language to be chosen before installing WordPress. First pass.
* Checks WordPress.org for available languages.
* In get_locale(), starts using the WPLANG option that has existed in multisite since the MU days.
* Adds new argument to wp_install() for setting WPLANG.

see #28577. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@28587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-18 19:58:15 +00:00