Skip to content

Commit 1cc10a2

Browse files
Improve I18N (#63)
1. If there are strings in your plugin that are also used in WordPress core (e.g. ‘Settings’), you should still add your text domain to them, otherwise they’ll become untranslated if the core string changes (which happens). 2. Adding Text Domain for some UI strings missing text domain.
1 parent 9cf5027 commit 1cc10a2

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

src/class-tiny-notices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ private function show_incompatible_plugins( $incompatible_plugins ) {
281281
$query_string = 'action=deactivate&plugin=' . $file . '&_wpnonce=' . $nonce;
282282
$url = admin_url( 'plugins.php?' . $query_string );
283283
$notice .= '<a class="button button-primary" href="' . $url . '">';
284-
$notice .= esc_html__( 'Deactivate' );
284+
$notice .= esc_html__( 'Deactivate', 'tiny-compress-images' );
285285
$notice .= '</a></td></tr>';
286286
}
287287
$notice .= '</table>';

src/class-tiny-settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,9 +660,9 @@ public function render_resize() {
660660
echo wp_kses( __( 'Resizing takes <strong>1 additional compression</strong> for each image that is larger.', 'tiny-compress-images' ), $strong ); // WPCS: Needed for proper translation.
661661
echo '</span>';
662662
echo '<div class="tiny-resize-inputs">';
663-
printf( '%s: ', esc_html__( 'Max Width' ) );
663+
printf( '%s: ', esc_html__( 'Max Width', 'tiny-compress-images' ) );
664664
$this->render_resize_input( 'width' );
665-
printf( '%s: ', esc_html__( 'Max Height' ) );
665+
printf( '%s: ', esc_html__( 'Max Height', 'tiny-compress-images' ) );
666666
$this->render_resize_input( 'height' );
667667
echo '</div></div></div>';
668668

src/views/account-status-connected.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@
7777
name="tinypng_api_key" size="35" spellcheck="false"
7878
value="<?php echo esc_attr( $key ); ?>">
7979
<button class="button button-primary" data-tiny-action="update-key"><?php
80-
esc_html_e( 'Save' );
80+
esc_html_e( 'Save', 'tiny-compress-images' );
8181
?></button>
8282
<p class="message"></p>
8383
<p>
84-
<a href="#" id="cancel-change-key"><?php esc_html_e( 'Cancel' ); ?></a>
84+
<a href="#" id="cancel-change-key"><?php esc_html_e( 'Cancel', 'tiny-compress-images' ); ?></a>
8585
</p>
8686
</div>
8787

src/views/account-status-create-advanced.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<p class="message"></p>
5353

5454
<button class="button button-primary" data-tiny-action="update-key">
55-
<?php esc_html_e( 'Save' ); ?>
55+
<?php esc_html_e( 'Save', 'tiny-compress-images' ); ?>
5656
</button>
5757
</div>
5858
</div>

src/views/compress-details.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@
120120
</h3>
121121
<table>
122122
<tr>
123-
<th><?php esc_html_e( 'Size' ) ?></th>
123+
<th><?php esc_html_e( 'Size', 'tiny-compress-images' ) ?></th>
124124
<th><?php esc_html_e( 'Initial Size', 'tiny-compress-images' ) ?></th>
125125
<th><?php esc_html_e( 'Compressed', 'tiny-compress-images' ) ?></th>
126126
<th><?php esc_html_e( 'Format', 'tiny-compress-images' ) ?></th>
127127
<?php if ( $conversion_enabled ) { ?> <th><?php esc_html_e( 'Converted', 'tiny-compress-images' ) ?></th> <?php } ?>
128-
<th><?php esc_html_e( 'Date' ) ?></th>
128+
<th><?php esc_html_e( 'Date', 'tiny-compress-images' ) ?></th>
129129
</tr>
130130
<?php
131131
$i = 0;
@@ -168,7 +168,7 @@
168168
echo '<td>' . $size->conversion_text() . '</td>';
169169
}
170170
/* translators: %s human friendly time difference */
171-
echo '<td>' . sprintf( esc_html__( '%s ago' ), human_time_diff( $size->end_time( $size_name ) ) ) . '</td>';
171+
echo '<td>' . sprintf( esc_html__( '%s ago', 'tiny-compress-images' ), human_time_diff( $size->end_time( $size_name ) ) ) . '</td>';
172172
} elseif ( ! $size->exists() ) {
173173
echo '<td>-</td>';
174174
echo '<td colspan=4><em>' . esc_html__( 'Not present', 'tiny-compress-images' ) . '</em></td>';

src/views/settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
</table>
6262
<p><?php echo Tiny_Plugin::request_review();?></p>
6363
<p class="submit">
64-
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_html_e( 'Save Changes' ) ?>">
64+
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_html_e( 'Save Changes', 'tiny-compress-images' ) ?>">
6565
</p>
6666
</form>
6767
</div>

0 commit comments

Comments
 (0)