Skip to content

REST: Add missing text domain and fix typos in REST API controller strings - #644

Open
devmuhib009 wants to merge 1 commit into
WordPress:developfrom
devmuhib009:fix/643-rest-i18n-text-domains
Open

devmuhib009 wants to merge 1 commit into
WordPress:developfrom
devmuhib009:fix/643-rest-i18n-text-domains

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

What?

Adds the missing 'wp-feature-notifications' text domain argument to all __( ... ) translation calls in the REST API controllers and fixes grammatical typos and punctuation in user-facing error messages and schema descriptions.

Why?

Fixes #643.

In includes/restapi/:

  • All __( '...' ) translation calls omitted the plugin's text domain argument. Without the text domain, WordPress translation systems cannot accurately extract or localize these strings.
  • Several error messages and schema descriptions had grammatical errors:
    • class-channel-controller.php: "Sorry, you must be logged to view channels." (missing "in"); "The default view context the notification channel." (missing "of").
    • class-notification-controller.php: "Sorry, you must be logged check notifications." (missing "in to"); "The URL of the accept action.." (extra period); "The view context the notification." (missing "of"); "The identifier of user the notification is belongs to." (grammatical error).
    • class-subscription-controller.php: "The identifier of user the subscription is belongs to." (grammatical error).

How?

  • Added 'wp-feature-notifications' as the second argument to all __( ... ) calls across:
    • includes/restapi/class-channel-controller.php
    • includes/restapi/class-notification-controller.php
    • includes/restapi/class-subscription-controller.php
  • Fixed grammatical issues, missing prepositions, and double periods in the localized strings.

Testing Instructions

  1. Run composer lint to verify that all files conform to WordPress Coding Standards.
  2. Run unit tests in wp-env:
    npx wp-env run tests-cli --env-cwd=wp-content/plugins/WPFeatureNotification vendor/bin/phpunit
  3. Confirm all tests pass with 0 regressions.

Screenshots or screencast

Not applicable (REST schema/controller strings only).

Cc @Sephsekla @erikyo @johnhooks for review.

@masteradhoc masteradhoc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @devmuhib009! While this looks good i saw there are several other locations in the code that dont yet have a text domain attached. Might be worth checking in a separate PR in case you have some time?

CC: @jonathanbossenger

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST: Add missing text domain and fix typos in REST API controller strings

2 participants