Skip to content

Commit 81c05cb

Browse files
committed
updated changelog, ignore disabled translations in all formats but po
1 parent 3493b73 commit 81c05cb

17 files changed

Lines changed: 46 additions & 45 deletions

CHANGELOG.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## [4.4.4] - 2017-08-09
8+
Previous releases are documented in [github releases](https://github.com/oscarotero/Gettext/releases)
9+
10+
## [4.5.0] - 2018-04-23
11+
12+
### Added
13+
14+
- Support for disabled translations
15+
16+
### Fixed
17+
18+
- Added php-7.2 to travis
19+
- Fixed po tests on bigendian [#159](https://github.com/oscarotero/Gettext/issues/159)
20+
- Improved comment estraction [#166](https://github.com/oscarotero/Gettext/issues/166)
21+
- Fixed incorrect docs to dn__ function [#170](https://github.com/oscarotero/Gettext/issues/170)
22+
- Ignored phpcs.xml file on export [#168](https://github.com/oscarotero/Gettext/issues/168)
23+
- Improved `@method` docs in `Translations` [#175](https://github.com/oscarotero/Gettext/issues/175)
24+
25+
## [4.4.4] - 2018-02-21
926

1027
### Fixed
1128

@@ -65,13 +82,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6582

6683
- Fixed a bug related with the javascript source extraction with single quotes
6784

68-
---
69-
70-
Previous releases are documented in [github releases](https://github.com/oscarotero/Gettext/releases)
7185

86+
[4.5.0]: https://github.com/oscarotero/Gettext/compare/v4.4.4...v4.5.0
7287
[4.4.4]: https://github.com/oscarotero/Gettext/compare/v4.4.3...v4.4.4
7388
[4.4.3]: https://github.com/oscarotero/Gettext/compare/v4.4.2...v4.4.3
7489
[4.4.2]: https://github.com/oscarotero/Gettext/compare/v4.4.1...v4.4.2
7590
[4.4.1]: https://github.com/oscarotero/Gettext/compare/v4.4.0...v4.4.1
7691
[4.4.0]: https://github.com/oscarotero/Gettext/compare/v4.3.0...v4.4.0
77-
[4.3.0]: https://github.com/oscarotero/Gettext/compare/v4.2.0...v4.3.0
92+
[4.3.0]: https://github.com/oscarotero/Gettext/compare/v4.2.0...v4.3.0

src/Generators/Csv.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ public static function toString(Translations $translations, array $options = [])
3434
}
3535

3636
foreach ($translations as $translation) {
37+
if ($translation->isDisabled()) {
38+
continue;
39+
}
40+
3741
$line = [$translation->getContext(), $translation->getOriginal(), $translation->getTranslation()];
3842

3943
if ($translation->hasPluralTranslations(true)) {

src/Generators/Jed.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ private static function buildMessages(Translations $translations)
4444
$context_glue = '\u0004';
4545

4646
foreach ($translations as $translation) {
47+
if ($translation->isDisabled()) {
48+
continue;
49+
}
50+
4751
$key = ($translation->hasContext() ? $translation->getContext().$context_glue : '')
4852
.$translation->getOriginal();
4953

src/Generators/Mo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static function toString(Translations $translations, array $options = [])
2626
}
2727

2828
foreach ($translations as $translation) {
29-
if (!$translation->hasTranslation()) {
29+
if (!$translation->hasTranslation() || $translation->isDisabled()) {
3030
continue;
3131
}
3232

src/Utils/DictionaryTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ private static function toArray(Translations $translations, $includeHeaders)
2929
}
3030

3131
foreach ($translations as $translation) {
32+
if ($translation->isDisabled()) {
33+
continue;
34+
}
35+
3236
$messages[$translation->getOriginal()] = $translation->getTranslation();
3337
}
3438

src/Utils/MultidimensionalArrayTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ private static function toArray(Translations $translations, $includeHeaders, $fo
3535
}
3636

3737
foreach ($translations as $translation) {
38+
if ($translation->isDisabled()) {
39+
continue;
40+
}
41+
3842
$context = $translation->getContext();
3943
$original = $translation->getOriginal();
4044

tests/AssetsTest.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ public function testPo()
3434
$this->assertContent($translations, 'po/YamlDictionary');
3535

3636
$this->runTestFormat('po/Po', $countTranslations, $countTranslated, $countHeaders);
37-
$this->runTestFormat('po/Mo', $countTranslations, $countTranslated, $countHeaders);
38-
$this->runTestFormat('po/PhpArray', $countTranslations, $countTranslated, $countHeaders);
39-
$this->runTestFormat('po/Jed', $countTranslations, $countTranslated, 10);
37+
$this->runTestFormat('po/Mo', $countTranslations - 1, $countTranslated - 1, $countHeaders);
38+
$this->runTestFormat('po/PhpArray', $countTranslations - 1, $countTranslated - 1, $countHeaders);
39+
$this->runTestFormat('po/Jed', $countTranslations - 1, $countTranslated - 1, 10);
4040
$this->runTestFormat('po/Xliff', $countTranslations, $countTranslated, $countHeaders);
41-
$this->runTestFormat('po/Json', $countTranslations, $countTranslated, $countHeaders);
42-
$this->runTestFormat('po/JsonDictionary', $countTranslations, $countTranslated);
43-
$this->runTestFormat('po/Csv', $countTranslations, $countTranslated, $countHeaders);
44-
$this->runTestFormat('po/CsvDictionary', $countTranslations, $countTranslated);
45-
$this->runTestFormat('po/Yaml', $countTranslations, $countTranslated, $countHeaders);
46-
$this->runTestFormat('po/YamlDictionary', $countTranslations, $countTranslated);
41+
$this->runTestFormat('po/Json', $countTranslations - 1, $countTranslated - 1, $countHeaders);
42+
$this->runTestFormat('po/JsonDictionary', $countTranslations - 1, $countTranslated - 1);
43+
$this->runTestFormat('po/Csv', $countTranslations - 1, $countTranslated - 1, $countHeaders);
44+
$this->runTestFormat('po/CsvDictionary', $countTranslations - 1, $countTranslated - 1);
45+
$this->runTestFormat('po/Yaml', $countTranslations - 1, $countTranslated - 1, $countHeaders);
46+
$this->runTestFormat('po/YamlDictionary', $countTranslations - 1, $countTranslated - 1);
4747
}
4848

4949
public function testPo2()
@@ -351,7 +351,6 @@ public function testPhpCode3()
351351
$this->assertCount($countHeaders, $translations->getHeaders());
352352
$this->assertEquals(0, $translations->countTranslated());
353353

354-
self::saveContent($translations, 'phpcode3/Po');
355354
$this->assertContent($translations, 'phpcode3/Po');
356355
$this->assertContent($translations, 'phpcode3/Mo');
357356
$this->assertContent($translations, 'phpcode3/PhpArray');

tests/TranslatorTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ public function testPlural()
6464
$this->assertEquals('5-21 plików', $t->ngettext('one file', 'multiple files', 5));
6565
$this->assertEquals('5-21 plików', $t->ngettext('one file', 'multiple files', 6));
6666

67-
// Test that when less then the nplural translations are available it still works.
68-
$this->assertEquals('1', $t->ngettext('one', 'more', 1));
69-
$this->assertEquals('*', $t->ngettext('one', 'more', 2));
70-
$this->assertEquals('*', $t->ngettext('one', 'more', 3));
71-
7267
// Test that non-plural translations the fallback still works.
7368
$this->assertEquals('more', $t->ngettext('single', 'more', 3));
7469

tests/assets/po/Csv.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ Project-Id-Version:
99
Report-Msgid-Bugs-To:
1010
"
1111
,"one file","1 plik","2,3,4 pliki","5-21 plików"
12-
,one,1,*
1312
,single,test

tests/assets/po/CsvDictionary.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
"one file","1 plik"
2-
one,1
32
single,test

0 commit comments

Comments
 (0)