diff --git a/onesignal.php b/onesignal.php index 431cdd0..d4a1c57 100644 --- a/onesignal.php +++ b/onesignal.php @@ -10,6 +10,8 @@ * Author: OneSignal * Author URI: https://onesignal.com * License: MIT + * Text Domain: onesignal-free-web-push-notifications + * Domain Path: /languages */ // Define plugin constants @@ -69,7 +71,7 @@ function migration_notice() { $screen = get_current_screen(); if ($screen && $screen->id === 'plugins') { echo '
-

OneSignal Migration Needed: All OneSignal prompt configurations are moving to OneSignal.com. See the plugin page for more info.

+

' . esc_html__( 'OneSignal Migration Needed:', 'onesignal-free-web-push-notifications' ) . ' ' . esc_html__( 'All OneSignal prompt configurations are moving to OneSignal.com. See the plugin page for more info.', 'onesignal-free-web-push-notifications' ) . '

'; } } diff --git a/v2/onesignal-admin.php b/v2/onesignal-admin.php index 670fb24..5445da4 100644 --- a/v2/onesignal-admin.php +++ b/v2/onesignal-admin.php @@ -243,7 +243,7 @@ function admin_notice_error() // Add our meta box for the "post" post type (default) add_meta_box('onesignal_notif_on_post', - 'OneSignal Push Notifications', + __( 'OneSignal Push Notifications', 'onesignal-free-web-push-notifications' ), array(__CLASS__, 'onesignal_notif_on_post_html_view'), 'post', 'side', @@ -260,7 +260,7 @@ function admin_notice_error() foreach ($post_types as $post_type) { add_meta_box( 'onesignal_notif_on_post', - 'OneSignal Push Notifications', + __( 'OneSignal Push Notifications', 'onesignal-free-web-push-notifications' ), array(__CLASS__, 'onesignal_notif_on_post_html_view'), $post_type, 'side', @@ -319,9 +319,11 @@ public static function onesignal_notif_on_post_html_view($post) } ?>> post_status === 'publish') { - echo esc_attr('Send notification on '.$post_type.' update'); + /* translators: %s: post type (e.g. post, page) */ + echo esc_attr( sprintf( __( 'Send notification on %s update', 'onesignal-free-web-push-notifications' ), $post_type ) ); } else { - echo esc_attr('Send notification on '.$post_type.' publish'); + /* translators: %s: post type (e.g. post, page) */ + echo esc_attr( sprintf( __( 'Send notification on %s publish', 'onesignal-free-web-push-notifications' ), $post_type ) ); } ?> @@ -330,21 +332,21 @@ public static function onesignal_notif_on_post_html_view($post)
> Customize notification content + } ?>> @@ -384,7 +386,7 @@ public static function save_config_page($config) { if (!OneSignalUtils::can_modify_plugin_settings()) { set_transient('onesignal_transient_error', '
-

OneSignal Push: Only administrators are allowed to save plugin settings.

+

' . esc_html__( 'OneSignal Push:', 'onesignal-free-web-push-notifications' ) . ' ' . esc_html__( 'Only administrators are allowed to save plugin settings.', 'onesignal-free-web-push-notifications' ) . '

', 86400); return; @@ -573,7 +575,7 @@ function admin_notice_setup_not_complete() });
-

OneSignal Push: Your setup is not complete. Please follow the Setup guide to set up web push notifications. Both the App ID and REST API Key fields are required.

+

-

OneSignal Push: cURL is not installed on this server. cURL is required to send notifications. Please make sure cURL is installed on your server before continuing.

+

0) { + /* translators: 1: Number of seconds to wait, 2: API rate limit in seconds */ + $error_message = sprintf( + __( 'Please try again in %1$d seconds. Only one notification can be sent every %2$d seconds.', 'onesignal-free-web-push-notifications' ), + $time_to_wait, + ONESIGNAL_API_RATE_LIMIT_SECONDS + ); set_transient('onesignal_transient_error', '
-

OneSignal Push: Please try again in '.$time_to_wait.' seconds. Only one notification can be sent every '.ONESIGNAL_API_RATE_LIMIT_SECONDS.' seconds.

+

' . esc_html__( 'OneSignal Push:', 'onesignal-free-web-push-notifications' ) . ' ' . esc_html( $error_message ) . '

', 86400); return; @@ -826,7 +834,7 @@ public static function send_notification_on_wp_post($new_status, $old_status, $p $site_title = qtrans_use($qtransLang, $site_title, false); $notif_content = qtrans_use($qtransLang, $notif_content, false); } catch (Exception $e) { - return new WP_Error('err', __( "OneSignal: There was a problem sending a notification")); + return new WP_Error('err', __( 'OneSignal: There was a problem sending a notification', 'onesignal-free-web-push-notifications' )); } } @@ -923,7 +931,7 @@ public static function send_notification_on_wp_post($new_status, $old_status, $p if (is_null($response)) { set_transient('onesignal_transient_error', '
-

OneSignal Push: There was a problem sending your notification.

+

' . esc_html__( 'OneSignal Push:', 'onesignal-free-web-push-notifications' ) . ' ' . esc_html__( 'There was a problem sending your notification.', 'onesignal-free-web-push-notifications' ) . '

', 86400); return; } @@ -941,13 +949,15 @@ public static function send_notification_on_wp_post($new_status, $old_status, $p if ($status !== 200) { if ($status !== 0) { + /* translators: %d: HTTP status code */ + $error_message = sprintf( __( 'There was a %d error sending your notification.', 'onesignal-free-web-push-notifications' ), $status ); set_transient('onesignal_transient_error', '
-

OneSignal Push: There was a '.$status.' error sending your notification.

+

' . esc_html__( 'OneSignal Push:', 'onesignal-free-web-push-notifications' ) . ' ' . esc_html( $error_message ) . '

', 86400); } else { // A 0 HTTP status code means the connection couldn't be established set_transient('onesignal_transient_error', '
-

OneSignal Push: There was an error establishing a network connection. Please make sure outgoing network connections from cURL are allowed.

+

' . esc_html__( 'OneSignal Push:', 'onesignal-free-web-push-notifications' ) . ' ' . esc_html__( 'There was an error establishing a network connection. Please make sure outgoing network connections from cURL are allowed.', 'onesignal-free-web-push-notifications' ) . '

', 86400); } } else { @@ -956,10 +966,11 @@ public static function send_notification_on_wp_post($new_status, $old_status, $p if ($config_show_notification_send_status_message) { $app_id = $onesignal_wp_settings['app_id']; - $delivery_link_text = ' Go to your app\'s Delivery tab to check sent messages: https://dashboard.onesignal.com/apps/' . $app_id . '/notifications'; + $delivery_link_url = esc_url( 'https://dashboard.onesignal.com/apps/' . $app_id . '/notifications' ); + $delivery_link_text = ' ' . __( "Go to your app's Delivery tab to check sent messages:", 'onesignal-free-web-push-notifications' ) . ' ' . $delivery_link_url . ''; set_transient('onesignal_transient_success', '
-

OneSignal Push: Successfully scheduled a notification.' . $delivery_link_text . '

+

' . esc_html__( 'OneSignal Push:', 'onesignal-free-web-push-notifications' ) . ' ' . esc_html__( 'Successfully scheduled a notification.', 'onesignal-free-web-push-notifications' ) . $delivery_link_text . '

', 86400); } @@ -974,7 +985,7 @@ public static function send_notification_on_wp_post($new_status, $old_status, $p return $response; } } catch (Exception $e) { - return new WP_Error('err', __( "OneSignal: There was a problem sending a notification")); + return new WP_Error('err', __( 'OneSignal: There was a problem sending a notification', 'onesignal-free-web-push-notifications' )); } } public static function was_post_restored_from_trash($old_status, $new_status) diff --git a/v2/onesignal-public.php b/v2/onesignal-public.php index eac9f8d..1f49799 100644 --- a/v2/onesignal-public.php +++ b/v2/onesignal-public.php @@ -430,7 +430,7 @@ public static function insert_amp_one_signal_widget() { @@ -438,7 +438,7 @@ public static function insert_amp_one_signal_widget() { 'Subscribe to notifications')); + parent::__construct('OneSignalWidget', 'OneSignal', array( 'description' => __( 'Subscribe to notifications', 'onesignal-free-web-push-notifications' ) )); } // Admin editor function form($instance) { - $title = ! empty( $instance['title'] ) ? $instance['title'] : 'Follow'; - $text = ! empty( $instance['text'] ) ? $instance['text'] : 'Subscribe to notifications'; + $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Follow', 'onesignal-free-web-push-notifications' ); + $text = ! empty( $instance['text'] ) ? $instance['text'] : __( 'Subscribe to notifications', 'onesignal-free-web-push-notifications' ); ?>

- + - +

@@ -95,19 +96,19 @@
- Account Settings +
> - +
- This option is disabled when your current URL begins with http://. Please access this page using https:// to enable this option. + http://. Please access this page using https:// to enable this option.', 'onesignal-free-web-push-notifications' ) ); ?>
@@ -119,46 +120,47 @@ (OneSignalUtils::url_contains_parameter(ONESIGNAL_URI_REVEAL_PROJECT_NUMBER)) ): ?>
- - + +
- +
- +
- + -
Once your site is public, do not change your label. If you do, users will receive duplicate notifications.
+
do not change your label. If you do, users will receive duplicate notifications.', 'onesignal-free-web-push-notifications' ) ); ?>
- +
- Sent Notification Settings +
> - +
> - + +
@@ -191,7 +193,7 @@ $onesignal_wp_settings['persist_notifications'] === "platform-default")) { echo "selected"; } - ?>>Yes + ?>>
@@ -227,7 +229,7 @@
- Prompt Settings & Subscription Bell +
@@ -450,7 +452,7 @@
- Prompt Customization +
@@ -510,7 +512,7 @@
- Welcome Notification Settings +
@@ -540,7 +542,7 @@
- Automatic Notification Settings +
@@ -560,7 +562,7 @@
- UTM Tracking Settings +
@@ -572,7 +574,7 @@
- Advanced Settings +
@@ -608,10 +610,10 @@
- +
- Your OneSignal subdomain cannot be empty or less than 4 characters. Use the same one you entered on the platform settings at onesignal.com. +
diff --git a/v3/onesignal-admin/onesignal-admin.php b/v3/onesignal-admin/onesignal-admin.php index 9064420..adbbbed 100644 --- a/v3/onesignal-admin/onesignal-admin.php +++ b/v3/onesignal-admin/onesignal-admin.php @@ -8,7 +8,14 @@ function onesignal_admin_menu() { - add_menu_page('OneSignal - Push Notifications', 'OneSignal', 'manage_options', 'onesignal-admin-page.php', 'onesignal_admin_page', 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAwIiBoZWlnaHQ9IjMwMCIgdmlld0JveD0iMCAwIDMwMCAzMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xNDkuNzAyIDAuMDAwMjg4MzI0QzY2Ljk0NDQgMC4xNjEyMDYgLTAuNDY4ODA1IDY4LjEwODkgMC4wMDI0NTU4NSAxNTAuODY3QzAuNDE2MjQ2IDIyOC4xNTkgNTkuMzU4MyAyOTEuNjEzIDEzNC43NiAyOTkuMjIyQzEzNSAyOTkuMjQ2IDEzNS4yNDMgMjk5LjIxOSAxMzUuNDczIDI5OS4xNDRDMTM1LjcwMiAyOTkuMDY4IDEzNS45MTMgMjk4Ljk0NSAxMzYuMDkyIDI5OC43ODJDMTM2LjI3MSAyOTguNjIgMTM2LjQxNCAyOTguNDIxIDEzNi41MTEgMjk4LjJDMTM2LjYwOCAyOTcuOTc5IDEzNi42NTggMjk3LjczOSAxMzYuNjU2IDI5Ny40OThWMTQ5Ljk5OUgxMjUuMDM2QzEyNC41NzkgMTQ5Ljk5OSAxMjQuMTQgMTQ5LjgxNyAxMjMuODE3IDE0OS40OTRDMTIzLjQ5MyAxNDkuMTcxIDEyMy4zMTIgMTQ4LjczMiAxMjMuMzEyIDE0OC4yNzVWMTI1LjAyMkMxMjMuMzEyIDEyNC41NjUgMT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OneSignal - Push Notifications', 'onesignal-free-web-push-notifications' ), + __( 'OneSignal', 'onesignal-free-web-push-notifications' ), + 'manage_options', + 'onesignal-admin-page.php', + 'onesignal_admin_page', + 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAwIiBoZWlnaHQ9IjMwMCIgdmlld0JveD0iMCAwIDMwMCAzMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xNDkuNzAyIDAuMDAwMjg4MzI0QzY2Ljk0NDQgMC4xNjEyMDYgLTAuNDY4ODA1IDY4LjEwODkgMC4wMDI0NTU4NSAxNTAuODY3QzAuNDE2MjQ2IDIyOC4xNTkgNTkuMzU4MyAyOTEuNjEzIDEzNC43NiAyOTkuMjIyQzEzNSAyOTkuMjQ2IDEzNS4yNDMgMjk5LjIxOSAxMzUuNDczIDI5OS4xNDRDMTM1LjcwMiAyOTkuMDY4IDEzNS45MTMgMjk4Ljk0NSAxMzYuMDkyIDI5OC43ODJDMTM2LjI3MSAyOTguNjIgMTM2LjQxNCAyOTguNDIxIDEzNi41MTEgMjk4LjJDMTM2LjYwOCAyOTcuOTc5IDEzNi42NTggMjk3LjczOSAxMzYuNjU2IDI5Ny40OThWMTQ5Ljk5OUgxMjUuMDM2QzEyNC41NzkgMTQ5Ljk5OSAxMjQuMTQgMTQ5LjgxNyAxMjMuODE3IDE0OS40OTRDMTIzLjQ5MyAxNDkuMTcxIDEyMy4zMTIgMTQ4LjczMiAxMjMuMzEyIDE0OC4yNzVWMTI1LjAyMkMxMjMuMzEyIDEyNC41NjUgMTIzLjQ5MyAxMjQuMTI2IDEyMy44MTcgMTIzLjgwM0MxMjQuMTQgMTIzLjQ4IDEyNC41NzkgMTIzLjI5OCAxMjUuMDM2IDEyMy4yOThIMTYxLjYyMkMxNjIuMDc5IDEyMy4yOTggMTYyLjUxOCAxMjMuNDggMTYyLjg0MSAxMjMuODAzQzE2My4xN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ny4xNzQgNTQuMTgzNyA1NS4wNzY3IDk1LjU1NjkgNTMuNDM4OCAxNDYuODU1QzUyLjgzOTkgMTY1LjYzNSA1Ny43MjQ4IDE4NC4xODIgNjcuNDk2MyAyMDAuMjMxQzc3LjI2NzcgMjE2LjI3OSA5MS41MDI3IDIyOS4xMzMgMTA4LjQ2MSAyMzcuMjIyQzEwOC45MDUgMjM3LjQzMSAxMDkuMjggMjM3Ljc2MSAxMDkuNTQzIDIzOC4xNzRDMTA5LjgwNyAyMzguNTg3IDEwOS45NDggMjM5LjA2NiAxMDkuOTUgMjM5LjU1NlYyNjQuMTgyQzEwOS45NSAyNjQuNDU4IDEwOS44ODQgMjY0LjczIDEwOS43NTcgMjY0Ljk3NUMxMDkuNjMgMjY1LjIyIDEwOS40NDcgMjY1LjQzMSAxMDkuMjIxIDI2NS41OUMxMDguOTk2IDI2NS43NSAxMDguNzM2IDI2NS44NTMgMTA4LjQ2MyAyNjUuODkxQzEwOC4xODkgMjY1LjkyOSAxMDcuOTExIDI2NS45IDEwNy42NTEgMjY1LjgwOEM2MC4xMjg0IDI0OC4zNzcgMjYuMjE0OSAyMDIuNDcgMjYuNzAzNCAxNDguODVDMjcuMzA2OCA4MS44Njc0IDgyLjAyNDggMjcuMjE4NCAxNDkuMDMgMjYuNzAxMkMyMTcuNDYgMjYuMTcyNSAyNzMuMjk5IDgxLjY4OTIgMjczLjI5OSAxNDkuOTk5QzI3My4yOTkgMjAzLjExOSAyMzkuNTM1IDI0OC40OTggMTkyLjM2OSAyNjUuODAzWiIgZmlsbD0iI0U1NEI0RCIvPgo8L3N2Zz4K', + 81); } // Load style for page @@ -101,20 +108,20 @@ function onesignal_admin_page() ?>
-

Settings

+

- +
@@ -126,17 +133,18 @@ function onesignal_admin_page()
-