Title: Incorrect language installation status when plugin's slug is different from its text domain · Issue #136 · wp-cli/language-command · GitHub
Open Graph Title: Incorrect language installation status when plugin's slug is different from its text domain · Issue #136 · wp-cli/language-command
X Title: Incorrect language installation status when plugin's slug is different from its text domain · Issue #136 · wp-cli/language-command
Description: Bug Report Yes, I reviewed the contribution guidelines. Yes, more specifically, I reviewed the guidelines on how to write clear bug reports. Describe the current, buggy behavior When listing available languages for a plugin using the wp ...
Open Graph Description: Bug Report Yes, I reviewed the contribution guidelines. Yes, more specifically, I reviewed the guidelines on how to write clear bug reports. Describe the current, buggy behavior When listing availa...
X Description: Bug Report Yes, I reviewed the contribution guidelines. Yes, more specifically, I reviewed the guidelines on how to write clear bug reports. Describe the current, buggy behavior When listing availa...
Opengraph URL: https://github.com/wp-cli/language-command/issues/136
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect language installation status when plugin's slug is different from its text domain","articleBody":"## Bug Report\r\n\r\n- [x] Yes, I reviewed the [contribution guidelines](https://make.wordpress.org/cli/handbook/contributing/).\r\n- [x] Yes, more specifically, I reviewed the guidelines on [how to write clear bug reports](https://make.wordpress.org/cli/handbook/bug-reports/).\r\n\r\n**Describe the current, buggy behavior**\r\n\r\nWhen listing available languages for a plugin using the `wp language plugin list \u003cplugin>` command, the status is always `uninstalled` if the plugin's slug ≠ plugin's text domain.\r\n\r\nThis is due to the [wp_get_installed_translations()](https://developer.wordpress.org/reference/functions/wp_get_installed_translations/) method used in https://github.com/wp-cli/language-command/blob/24f76e35f477887d09f1fd40a60d9011a6da18bf/src/WP_CLI/CommandWithTranslation.php#L251-L257\r\n\r\n`wp_get_installed_translations()` returns an array keyed by the text domain. As a result, the subsequent check for available languages (`$available = ! empty( $available[ $slug ] ) ? array_keys( $available[ $slug ] ) : array();`) results in an empty array if the plugin's slug is different from its text domain.\r\n\r\n`get_installed_languages()` is used by the `list` command: https://github.com/wp-cli/language-command/blob/24f76e35f477887d09f1fd40a60d9011a6da18bf/src/Plugin_Language_Command.php#L92-L153\r\n\r\nThat's where the following check (against an empty `$installed_translations` array returned by `get_installed_languages()`) results in the `uninstalled` value: https://github.com/wp-cli/language-command/blob/24f76e35f477887d09f1fd40a60d9011a6da18bf/src/Plugin_Language_Command.php#L125\r\n\r\nA solution is to account for the discrepancy between plugin slugs and text domains in the `get_installed_languages()` method.","author":{"url":"https://github.com/mrcasual","@type":"Person","name":"mrcasual"},"datePublished":"2023-12-01T18:25:03Z","url":"https://github.com/wp-cli/language-command/issues/136"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:75cb9d0e-9c9d-3a98-929c-41cc1e3bb1dc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C066:1BB36A:12B100D:198ABCD:6AFB6C3B |
| html-safe-nonce | 6eade460a4a51a54af6a4f00a8481258ce9aa64a50724ccc46a13a4094403222 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDY2OjFCQjM2QToxMkIxMDBEOjE5OEFCQ0Q6NkFGQjZDM0IiLCJ2aXNpdG9yX2lkIjoiNzIzMTI5MzgxODM1OTkyMTIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 926c14372a6180e67686620e0dd1a8dcce28994d6b7dd44fb7e0018686b43da5 |
| hovercard-subject-tag | issue:2021381538 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/wp-cli/language-command/136/issue_layout |
| twitter:image | https://opengraph.githubassets.com/de4f3550a490a95fced40d8407a00f0258ca1b6fba7173ec4715df19cf3e2a94/wp-cli/language-command/issues/136 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/de4f3550a490a95fced40d8407a00f0258ca1b6fba7173ec4715df19cf3e2a94/wp-cli/language-command/issues/136 |
| og:image:alt | Bug Report Yes, I reviewed the contribution guidelines. Yes, more specifically, I reviewed the guidelines on how to write clear bug reports. Describe the current, buggy behavior When listing availa... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mrcasual |
| hostname | github.com |
| expected-hostname | github.com |
| None | cca289ecd54650fcf3c0b037a58b97186dee2cc4406819d87fab93728fd83700 |
| turbo-cache-control | no-preview |
| go-import | github.com/wp-cli/language-command git https://github.com/wp-cli/language-command.git |
| octolytics-dimension-user_id | 1570774 |
| octolytics-dimension-user_login | wp-cli |
| octolytics-dimension-repository_id | 87954652 |
| octolytics-dimension-repository_nwo | wp-cli/language-command |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 87954652 |
| octolytics-dimension-repository_network_root_nwo | wp-cli/language-command |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 88808b1fae5ab8a526a73e7ce5542a10eb9d6971 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width