Releases: php-gettext/Gettext
Releases · php-gettext/Gettext
4.0.2
4.0.1
3.6.1
4.0.0
Breaking changes
- PHP >= 5.4 compatibility (dropped PHP 5.3 support)
- New class
Merge, that changes the way to merge translations. Gettext\Translation::getPluralTranslation()renamed toTranslation::getPluralTranslations()and always returns an array with all plural translations- Removed the print functions like
__e(),n__e(),p__e(), etc. Use<?= __('text') ?>instead. - The format
PhpArrayhas a different structure - Removed
Gettext\Translation::normaliceTranslationCount()to improve performance - Removed
Gettext\Translator::initGettextFunction(). Use$translator->register(). - Invalid languages throw a
InvalidArgumentExceptioninTranslations::setLanguage() - If not specified, the default domain for translations is an empty string instead "messages"
- Changed the extractor and generator interfaces and allow to pass an array with the options instead use static properties.
- Removed the ability to include empty translations on generate Mo.
New extractors/generators
- Yaml
- Csv
- Xliff
- Json
Other changes
- Added the
$checkContentargument toTranslation::hasPluralTranslations()to check whether the plural translation contains any text or not - Added
Translations::$optionsto configure some default headers. - Prevent to insert duplicated comments, flags and extracted comments in a translation
Translations::register()returns the previous registered translations instance if exists.- Improved tests
- Bugfixes
- Code improvements
3.6.0
- #108 PhpCode extractor extracts also the following functions:
d__d__edp__dp__enp__np__ednp__dnp__egettextngettextpgettextdgettextdpgettextnpgettextdnpgettext
- Allow to configure the json output in Json formats #104
- Added CsvDictionary generator and extractor #106 (by @sourcerer-mike)
- Added YamlDictionary generator and extractor #105 (by @sourcerer-mike)
- Added the global functions
np__()andnp__e()#103 (by @kilahm)
3.5.9
Special thanks to @mlocati for the hard work:
phpCode extractor fixes:
The phpCode extractor has been deeptly rewritten to be fully compatible with GNU gettext #92 (comment). It means:
-
Fixed string containing backslashes #91:
__("Hello \n world"); __("Hello \t world"); __('Hello \' world'); __('Hello \\\t world'); //etc...
-
Fixed when the arguments contains concatenated strings or variables (to be fully compatible with xgettext behaviour) #98:
__('string1 '.'string 2'); __('hello '.$name);
-
Allow to collect comments #100 #102:
echo __(/* i18n: Test comment 1 */'test 1'); /* i18n: Test comment 2 */ echo __('test 2'); /* i18n: Test comment 3 */ echo __('test 3'); /* i18n: Test comment 4 */ echo __( 'test 4' );
To configure comment extraction:
Gettext\Extractors\PhpCode::$extractComments = false; //disable the comment extraction (by default) Gettext\Extractors\PhpCode::$extractComments = 'i18n:'; //collect only the comments begining with "i18n:" Gettext\Extractors\PhpCode::$extractComments = ''; //collect all comments
Other fixes:
3.5.8
3.5.7
- Fixed error when LC_MESSAGES constant is not available #89
- Code quality improved by @eusonlito