Skip to content

Commit 7400fd2

Browse files
author
Jippe Holwerda
committed
Fixed translations for plural and singular forms.
1 parent 95ca639 commit 7400fd2

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/class-tiny-wp-base.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ protected static function translate_escape($phrase) {
7070
return htmlspecialchars(translate($phrase, self::NAME));
7171
}
7272

73+
protected static function ntranslate_escape($single, $plural, $amount) {
74+
return htmlspecialchars(_n($single, $plural, $amount, self::NAME));
75+
}
76+
7377
public function __construct() {
7478
add_action('init', $this->get_method('init'));
7579
if (self::is_xmlrpc_request()) {

src/languages/tiny-compress-images-nl_NL.po

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ msgstr "%d afmeting niet gecomprimeerd"
4949
msgid "%d sizes not compressed"
5050
msgstr "%d afmetingen niet gecomprimeerd"
5151

52+
msgid "%d file removed"
53+
msgid "%d bestand verwijderd"
54+
55+
msgid "%d files removed"
56+
msgid "%d bestanden verwijderd"
57+
5258
msgid "%d file missing"
5359
msgstr "%d bestand bestaat niet"
5460

src/views/compress-details-processing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<span class="icon spinner"></span>
44
<span class="message">
55
<strong><?php echo $compressing ?></strong>
6-
<span><?php printf(self::translate_escape('%s being compressed'), $compressing == 1 ? 'size' : 'sizes'); ?></span>
6+
<span><?php printf(self::ntranslate_escape('size being compressed', 'sizes being compressed', $compressing)) ?></span>
77
</span>
88
</div>
99
</div>

src/views/compress-details.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@
1414
<?php if ($tiny_metadata->get_compressed_count() > 0 || ($tiny_metadata->get_compressed_count() == 0 && count($uncompressed) == 0)) { ?>
1515
<span class="message">
1616
<strong><?php echo $tiny_metadata->get_compressed_count() ?></strong>
17-
<span><?php printf(self::translate_escape('%s compressed'), ($tiny_metadata->get_compressed_count() == 1) ? "size" : "sizes") ?></span>
17+
<span><?php printf(self::ntranslate_escape('size compressed', 'sizes compressed', $tiny_metadata->get_compressed_count())) ?></span>
1818
</span>
1919
<br/>
2020
<?php } ?>
2121

2222
<?php if ($not_compressed_active > 0) { ?>
2323
<span class="message">
24-
<?php printf(self::translate_escape('%d %s not compressed'), $not_compressed_active, ($not_compressed_active == 1) ? "size" : "sizes") ?>
24+
<?php printf(self::ntranslate_escape('%d size not compressed', '%d sizes not compressed', $not_compressed_active), $not_compressed_active) ?>
2525
</span>
2626
<br />
2727
<?php } ?>
2828

2929
<?php if ($missing > 0) { ?>
3030
<span class="message">
31-
<?php printf(self::translate_escape('%d %s removed'), $missing, ($missing == 1) ? "file" : "files") ?>
31+
<?php printf(self::ntranslate_escape('%d file removed', '%d files removed', $missing), $missing) ?>
3232
</span>
3333
<br />
3434
<?php } ?>
3535

3636
<?php if ($modified > 0) { ?>
3737
<span class="message">
38-
<?php printf(self::translate_escape('%d %s modified after compression'), $modified, ($modified == 1) ? "file" : "files") ?>
38+
<?php printf(self::ntranslate_escape('%d file modified after compression', '%d files modified after compression', $modified), $modified) ?>
3939
</span>
4040
<br />
4141
<?php } ?>
4242

4343
<?php if ($savings["input"] - $savings["output"]) { ?>
4444
<span class="message">
45-
<?php printf(self::translate_escape( 'Total savings %s' ), str_replace( " ", "&nbsp;", size_format($savings["input"] - $savings["output"], 1))) ?>
45+
<?php printf(self::translate_escape('Total savings %s' ), str_replace( " ", "&nbsp;", size_format($savings["input"] - $savings["output"], 1))) ?>
4646
</span>
4747
<br />
4848
<?php } ?>

0 commit comments

Comments
 (0)