Skip to content

Conversation

@ShedFlu
Copy link

@ShedFlu ShedFlu commented Nov 6, 2025

Motivation

We are about to use thisplugin in a customers website, when a colleague asked why the checkbox, about whether or not to send notifications when publishing a post, is in english.
So I went ahead and wrapped these parts in WordPress' translation functions, but since I would already have to create a PR, I took the opportunity to make the entire plugin translation-ready.

Changes

This PR adds WordPress translation functions to most, if not all, user-facing strings across both the v2 and v3 codebases:

Files Modified:

  • plugin index file:
    • added text domain to header
    • migration notice
  • V2:
    • v2/onesignal-admin.php - meta boxes, admin notices,error messages
    • v2/views/config.php - all settings page content (that was a big one)
    • v2/onesignal-public.php - amp widget subscription messages
    • v2/onesignal-widget.php - labels and defaults
  • V3
    • v3/onesignal-admin/onesignal-admin.php - albels and messages
    • v3/onesignal-metabox/onesignal-metabox.php - meta box content

Implementation Details

  • Text domain: onesignal-free-web-push-notifications
    same as plugin folder name when installed
  • Uses appropriate WordPress translation functions (esc_attr__() etc.)
  • Adds translator comments for strings with placeholders
  • Fixed a typo or two

WordPress.org Integration

Once merged, community translators can add translations that will automatically be distributedto users without requiring translation files in the repo.

Testing

All strings were wrapped according to WordPress' best practices. The plugin should work identically in English, but is now ready for translation into any language.


Note: I tried to catch all user-facing strings, but if I missed any, lmk!


This change is Reviewable

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.

1 participant