Skip to content

Commit d89a593

Browse files
Improve I18N Issues based on 1.5.5
1 parent 1c9b006 commit d89a593

File tree

6 files changed

+68
-64
lines changed

6 files changed

+68
-64
lines changed

src/class-jetpack-importer.php

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,66 +21,66 @@ public function show_page(): void
2121
<div class="wrap" style="max-width: 820px;">
2222

2323
<?php if (isset($_GET['success']) && $_GET['success'] == 0) { ?>
24-
<div class="notice notice-error is-dismissible"><p>Sorry, something went wrong in trying to retrieve your stats from WordPress.com. Please check whether your API key and blog URL are correct.</p></div>
24+
<div class="notice notice-error is-dismissible"><p><?php esc_html_e( 'Sorry, something went wrong in trying to retrieve your stats from WordPress.com. Please check whether your API key and blog URL are correct.', 'koko-analytics' ); ?></p></div>
2525
<?php } ?>
2626

2727
<?php if (isset($_GET['success']) && $_GET['success'] == 1) { ?>
28-
<div class="notice notice-success is-dismissible"><p>Big success! Your stats are now imported into Koko Analytics.</p></div>
28+
<div class="notice notice-success is-dismissible"><p><?php esc_html_e( 'Big success! Your stats are now imported into Koko Analytics.', 'koko-analytics' ); ?></p></div>
2929
<?php } ?>
3030

31-
<h1>Import analytics from JetPack Stats</h1>
32-
<p>To import your historical analytics data from JetPack Stats into Koko Analytics, provide your WordPress.com API key and blog URL in the field below.</p>
31+
<h1><?php esc_html_e( 'Import analytics from JetPack Stats', 'koko-analytics' ); ?></h1>
32+
<p><?php esc_html_e( 'To import your historical analytics data from JetPack Stats into Koko Analytics, provide your WordPress.com API key and blog URL in the field below.', 'koko-analytics' ); ?></p>
3333

34-
<form method="post" onsubmit="return confirm('Are you sure you want to import statistics between ' + this['date-start'].value + ' and ' +this['date-end'].value + '? This will overwrite any existing data in your Koko Analytics database tables.');" action="<?php echo esc_attr(get_admin_url(null, '/index.php?page=koko-analytics&tab=jetpack_importer')); ?>">
34+
<form method="post" onsubmit="return confirm('<?php esc_attr_e('Are you sure you want to import statistics between', 'koko-analytics'); ?> ' + this['date-start'].value + '<?php esc_attr_e(' and ', 'koko-analytics'); ?>' + this['date-end'].value + '<?php esc_attr_e('? This will overwrite any existing data in your Koko Analytics database tables.', 'koko-analytics'); ?>');" action="<?php echo esc_url(admin_url('index.php?page=koko-analytics&tab=jetpack_importer')); ?>">
3535

3636
<input type="hidden" name="koko_analytics_action" value="start_jetpack_import">
3737
<?php wp_nonce_field('koko_analytics_start_jetpack_import'); ?>
3838

3939
<table class="form-table">
4040
<tr>
41-
<th><label for="wpcom-api-key">WordPress.com API key</label></th>
41+
<th><label for="wpcom-api-key"><?php esc_html_e( 'WordPress.com API key', 'koko-analytics' ); ?></label></th>
4242
<td>
4343
<input id="wpcom-api-key" type="text" class="regular-text" name="wpcom-api-key" required>
44-
<p class="description">You can <a href="https://apikey.wordpress.com/">find your WordPress.com API key here</a>.</p>
44+
<p class="description"><?php printf(esc_html__( 'You can %1$sfind your WordPress.com API key here%2$s.', 'koko-analytics' ),'<a href="https://apikey.wordpress.com/" target="_blank">','</a>'); ?></p>
4545
</td>
4646
</tr>
4747

4848
<tr>
49-
<th><label for="wpcom-blog-uri">Blog URL</label></th>
49+
<th><label for="wpcom-blog-uri"><?php esc_html_e( 'Blog URL', 'koko-analytics' ); ?></label></th>
5050
<td>
5151
<input id="wpcom-blog-uri" type="text" class="regular-text" name="wpcom-blog-uri" value="<?php echo esc_attr(get_site_url()); ?>" required>
52-
<p class="description">The full URL to the root directory of your blog. Including the full path.</p>
52+
<p class="description"><?php esc_html_e( 'The full URL to the root directory of your blog. Including the full path.', 'koko-analytics' ); ?></p>
5353
</td>
5454
</tr>
5555

5656
<tr>
57-
<th><label for="date-start">Start date</label></th>
57+
<th><label for="date-start"><?php esc_html_e( 'Start date', 'koko-analytics' ); ?></label></th>
5858
<td>
5959
<input id="date-start" name="date-start" type="date" value="<?php echo esc_attr(date('Y-m-d', strtotime('-1 year'))); ?>" required>
60-
<p class="description">The earliest date for which to import data. You should probably set this to the date that you installed and activated Jetpack Stats.</p>
60+
<p class="description"><?php esc_html_e( 'The earliest date for which to import data. You should probably set this to the date that you installed and activated Jetpack Stats.', 'koko-analytics' ); ?></p>
6161

6262
</td>
6363
</tr>
6464

6565
<tr>
66-
<th><label for="date-end">End date</label></th>
66+
<th><label for="date-end"><?php esc_html_e( 'End date', 'koko-analytics' ); ?></label></th>
6767
<td>
6868
<input id="date-end" name="date-end" type="date" value="<?php echo esc_attr(date('Y-m-d')); ?>" required>
69-
<p class="description">The last date for which to import data. You should probably set this to just before the date that you installed and activated Koko Analytics.</p>
69+
<p class="description"><?php esc_html_e( 'The last date for which to import data. You should probably set this to just before the date that you installed and activated Koko Analytics.', 'koko-analytics' ); ?></p>
7070

7171
</td>
7272
</tr>
7373
</table>
7474

7575
<p>
76-
<button type="submit" class="button">Import analytics data</button>
76+
<button type="submit" class="button"><?php esc_html_e( 'Import analytics data', 'koko-analytics' ); ?></button>
7777
</p>
7878
</form>
7979

8080
<div class="ka-margin-m">
81-
<h3>Things to know before running the import</h3>
82-
<p>Importing data for a given date range will add to any existing data. The import process can not be reverted unless you reinstate a back-up of your database in its current state.</p>
83-
<p>It's also important to know that JetPack doesn't provide data for the distinct number of visitors, so the data imported will only import the total number of pageviews for each post and therefore differ slightly from data collected by Koko Analytics itself.</p>
81+
<h3><?php esc_html_e( 'Things to know before running the import', 'koko-analytics' ); ?></h3>
82+
<p><?php esc_html_e( 'Importing data for a given date range will add to any existing data. The import process can not be reverted unless you reinstate a back-up of your database in its current state.', 'koko-analytics' ); ?></p>
83+
<p><?php esc_html_e( 'It\'s also important to know that JetPack doesn\'t provide data for the distinct number of visitors, so the data imported will only import the total number of pageviews for each post and therefore differ slightly from data collected by Koko Analytics itself.', 'koko-analytics' ); ?></p>
8484
</div>
8585
</div>
8686
<?php
@@ -193,10 +193,14 @@ public function import_chunk(): void
193193
?>
194194
<style>body { background: #f0f0f1; color: #3c434a; font-family: sans-serif; font-size: 16px; line-height: 1.5; padding: 32px; }</style>
195195
<meta http-equiv="refresh" content="1; url=<?php echo esc_attr($url); ?>">
196-
<h1>Liberating your data... Please wait.</h1>
197-
<p>Importing stats between <strong><?php echo $chunk_start->format('Y-m-d'); ?></strong> and <strong><?php echo $chunk_end->format('Y-m-d'); ?></strong>.</p>
198-
<p>Please do not close this browser tab while the importer is running.</p>
199-
<p>Estimated time left: <?php echo round($chunks_left * 1.5); ?> seconds.</p>
196+
<h1><?php esc_html_e( 'Liberating your data... Please wait.', 'koko-analytics' ); ?></h1>
197+
<p><?php printf(
198+
__('Importing stats between %1$s and %2$s.', 'koko-analytics'),
199+
'<strong>' . $chunk_start->format('Y-m-d') . '</strong>',
200+
'<strong>' . $chunk_end->format('Y-m-d') . '</strong>'
201+
);?></p>
202+
<p><?php esc_html_e( 'Please do not close this browser tab while the importer is running.', 'koko-analytics' ); ?></p>
203+
<p><?php printf( __( 'Estimated time left: %s seconds.', 'koko-analytics' ), round($chunks_left * 1.5) ); ?></p>
200204
<?php
201205
exit;
202206
}

src/class-widget-most-viewed-posts.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ public function form($instance)
9191
$post_types = get_post_types([ 'public' => true ], 'objects');
9292
?>
9393
<p>
94-
<label for="<?php echo $this->get_field_id('title'); ?>" style="display: block;"><?php echo esc_html__('Title:', 'koko-analytics'); ?></label>
94+
<label for="<?php echo $this->get_field_id('title'); ?>" style="display: block;"><?php esc_html_e('Title:', 'koko-analytics'); ?></label>
9595
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($settings['title']); ?>" />
9696
</p>
9797

9898
<p>
99-
<label for="<?php echo $this->get_field_id('post_type'); ?>" style="display: block;"><?php echo esc_html__('Post type:', 'koko-analytics'); ?></label>
99+
<label for="<?php echo $this->get_field_id('post_type'); ?>" style="display: block;"><?php esc_html_e('Post type:', 'koko-analytics'); ?></label>
100100
<select class="widefat" id="<?php echo $this->get_field_id('post_type'); ?>" name="<?php echo $this->get_field_name('post_type'); ?>">
101101
<?php
102102
foreach ($post_types as $post_type) {
@@ -108,18 +108,18 @@ public function form($instance)
108108
</p>
109109

110110
<p>
111-
<label for="<?php echo $this->get_field_id('days'); ?>" style="display: block;"><?php echo esc_html__('Number of days to use statistics for:', 'koko-analytics'); ?></label>
111+
<label for="<?php echo $this->get_field_id('days'); ?>" style="display: block;"><?php esc_html_e('Number of days to use statistics for:', 'koko-analytics'); ?></label>
112112
<input id="<?php echo $this->get_field_id('days'); ?>" name="<?php echo $this->get_field_name('days'); ?>" type="number" step="1" min="1" max="1975" value="<?php echo esc_attr($settings['days']); ?>" required class="tiny-text" size="3" />
113113
</p>
114114

115115
<p>
116-
<label for="<?php echo $this->get_field_id('number'); ?>" style="display: block;"><?php echo esc_html__('Number of posts to show:', 'koko-analytics'); ?></label>
116+
<label for="<?php echo $this->get_field_id('number'); ?>" style="display: block;"><?php esc_html_e('Number of posts to show:', 'koko-analytics'); ?></label>
117117
<input id="<?php echo $this->get_field_id('number'); ?>" class="tiny-text" name="<?php echo $this->get_field_name('number'); ?>" type="number" step="1" min="1" value="<?php echo esc_attr($settings['number']); ?>" size="3" />
118118
</p>
119119

120120
<p>
121121
<input class="checkbox" type="checkbox" <?php checked($settings['show_date']); ?> id="<?php echo $this->get_field_id('show_date'); ?>" name="<?php echo $this->get_field_name('show_date'); ?>" />
122-
<label for="<?php echo $this->get_field_id('show_date'); ?>"><?php echo esc_html__('Display post date?', 'koko-analytics'); ?></label>
122+
<label for="<?php echo $this->get_field_id('show_date'); ?>"><?php esc_html_e('Display post date?', 'koko-analytics'); ?></label>
123123
</p>
124124
<?php
125125

src/views/dashboard-page.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252
} ?>
5353

5454
<div class="ka-datepicker--dropdown-content">
55-
<label for="ka-date-presets"><?php echo esc_html__('Date range', 'koko-analytics'); ?></label>
55+
<label for="ka-date-presets"><?php esc_html_e('Date range', 'koko-analytics'); ?></label>
5656
<select id="ka-date-presets" name="view">
57-
<option value="custom" <?php echo $range === 'custom' ? 'selected' : ''; ?> disabled><?php echo esc_html__('Custom', 'koko-analytics'); ?></option>
57+
<option value="custom" <?php echo $range === 'custom' ? 'selected' : ''; ?> disabled><?php esc_html_e('Custom', 'koko-analytics'); ?></option>
5858
<?php foreach ($this->get_date_presets() as $key => $label) {
5959
?>
6060
<option value="<?php echo $key; ?>"
@@ -64,13 +64,13 @@
6464
</select>
6565
<div style="display: flex; margin-top: 12px;">
6666
<div>
67-
<label for='ka-date-start'><?php echo esc_html__('Start date', 'koko-analytics'); ?></label>
67+
<label for='ka-date-start'><?php esc_html_e('Start date', 'koko-analytics'); ?></label>
6868
<input name="start_date" id='ka-date-start' type="date" size="10" placeholder="YYYY-MM-DD" min="2000-01-01" max="2100-01-01"
6969
value="<?php echo $dateStart->format('Y-m-d'); ?>">
7070
<span>&nbsp;&mdash;&nbsp;</span>
7171
</div>
7272
<div>
73-
<label for='ka-date-end'><?php echo esc_html__('End date', 'koko-analytics'); ?></label>
73+
<label for='ka-date-end'><?php esc_html_e('End date', 'koko-analytics'); ?></label>
7474
<input name="end_date" id='ka-date-end' type="date" size="10" placeholder="YYYY-MM-DD" min="2000-01-01" max="2100-01-01"
7575
value="<?php echo $dateEnd->format('Y-m-d'); ?>">
7676
</div>
@@ -103,7 +103,7 @@
103103
$change = $totals_previous->visitors == 0 ? 0 : ($totals->visitors / $totals_previous->visitors) - 1;
104104
?>
105105
<tr class="<?php echo $diff > 0 ? 'ka-up' : ''; ?> <?php echo $diff < 0 ? 'ka-down' : ''; ?>">
106-
<th><?php echo esc_html__('Total visitors', 'koko-analytics'); ?></th>
106+
<th><?php esc_html_e('Total visitors', 'koko-analytics'); ?></th>
107107
<td class='ka-totals--amount'>
108108
<span title="<?php echo esc_attr($totals->visitors); ?>"><?php echo number_format_i18n($totals->visitors); ?></span>
109109
<span class="ka-totals--change">
@@ -130,7 +130,7 @@
130130
$change = $totals_previous->pageviews == 0 ? 0 : ($totals->pageviews / $totals_previous->pageviews) - 1;
131131
?>
132132
<tr class="<?php echo $diff > 0 ? 'ka-up' : ''; ?> <?php echo $diff < 0 ? 'ka-down' : ''; ?>">
133-
<th><?php echo esc_html__('Total pageviews', 'koko-analytics'); ?></th>
133+
<th><?php esc_html_e('Total pageviews', 'koko-analytics'); ?></th>
134134
<td class='ka-totals--amount'>
135135
<span title="<?php echo esc_attr($totals->pageviews); ?>"><?php echo number_format_i18n($totals->pageviews); ?></span>
136136
<span class="ka-totals--change">
@@ -152,10 +152,10 @@
152152
</td>
153153
</tr>
154154
<tr id="ka-realtime">
155-
<th><?php echo esc_html__('Realtime pageviews', 'koko-analytics'); ?></th>
155+
<th><?php esc_html_e('Realtime pageviews', 'koko-analytics'); ?></th>
156156
<td class='ka-totals--amount'><?php echo number_format_i18n($realtime); ?></td>
157157
<td class='ka-totals--subtext'>
158-
<?php echo esc_html__('pageviews in the last hour', 'koko-analytics'); ?>
158+
<?php esc_html_e('pageviews in the last hour', 'koko-analytics'); ?>
159159
</td>
160160
</tr>
161161
</tbody>
@@ -203,10 +203,10 @@
203203
<?php if ($posts_offset >= $posts_limit || $posts_offset + $posts_limit < $posts_count) { ?>
204204
<div class='ka-pagination'>
205205
<?php if ($posts_offset >= $posts_limit) { ?>
206-
<a class='ka-pagination--prev' href="<?php echo esc_attr(add_query_arg(['posts' => [ 'offset' => $posts_offset - $posts_limit, 'limit' => $posts_limit ]])); ?>"><?php echo esc_html__('Previous', 'koko-analytics'); ?></a>
206+
<a class='ka-pagination--prev' href="<?php echo esc_attr(add_query_arg(['posts' => [ 'offset' => $posts_offset - $posts_limit, 'limit' => $posts_limit ]])); ?>"><?php esc_html_e('Previous', 'koko-analytics'); ?></a>
207207
<?php } ?>
208208
<?php if ($posts_offset + $posts_limit < $posts_count) { ?>
209-
<a class='ka-pagination--next' href="<?php echo esc_attr(add_query_arg(['posts' => [ 'offset' => $posts_offset + $posts_limit, 'limit' => $posts_limit ]])); ?>"><?php echo esc_html__('Next', 'koko-analytics'); ?></a>
209+
<a class='ka-pagination--next' href="<?php echo esc_attr(add_query_arg(['posts' => [ 'offset' => $posts_offset + $posts_limit, 'limit' => $posts_limit ]])); ?>"><?php esc_html_e('Next', 'koko-analytics'); ?></a>
210210
<?php } ?>
211211
</div>
212212
<?php } ?>
@@ -244,10 +244,10 @@
244244
<?php if ($referrers_offset >= $referrers_limit || $referrers_offset + $referrers_limit < $referrers_count) { ?>
245245
<div class='ka-pagination'>
246246
<?php if ($referrers_offset >= $referrers_limit) { ?>
247-
<a class='ka-pagination--prev' href="<?php echo esc_attr(add_query_arg(['referrers' => [ 'offset' => $referrers_offset - $referrers_limit, 'limit' => $referrers_limit ]])); ?>"><?php echo esc_html__('Previous', 'koko-analytics'); ?></a>
247+
<a class='ka-pagination--prev' href="<?php echo esc_attr(add_query_arg(['referrers' => [ 'offset' => $referrers_offset - $referrers_limit, 'limit' => $referrers_limit ]])); ?>"><?php esc_html_e('Previous', 'koko-analytics'); ?></a>
248248
<?php } ?>
249249
<?php if ($referrers_offset + $referrers_limit < $referrers_count) { ?>
250-
<a class='ka-pagination--next' href="<?php echo esc_attr(add_query_arg(['referrers' => [ 'offset' => $referrers_offset + $referrers_limit, 'limit' => $referrers_limit ]])); ?>"><?php echo esc_html__('Next', 'koko-analytics'); ?></a>
250+
<a class='ka-pagination--next' href="<?php echo esc_attr(add_query_arg(['referrers' => [ 'offset' => $referrers_offset + $referrers_limit, 'limit' => $referrers_limit ]])); ?>"><?php esc_html_e('Next', 'koko-analytics'); ?></a>
251251
<?php } ?>
252252
</div>
253253
<?php } ?>

0 commit comments

Comments
 (0)