i18n: Add translation support for all user-facing strings #384
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
v2/onesignal-admin.php- meta boxes, admin notices,error messagesv2/views/config.php- all settings page content (that was a big one)v2/onesignal-public.php- amp widget subscription messagesv2/onesignal-widget.php- labels and defaultsv3/onesignal-admin/onesignal-admin.php- albels and messagesv3/onesignal-metabox/onesignal-metabox.php- meta box contentImplementation Details
onesignal-free-web-push-notificationssame as plugin folder name when installed
esc_attr__()etc.)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