Skip to content

Releases: php-gettext/Gettext

4.0.2

31 Aug 09:51
Compare
Choose a tag to compare
  • Fixed plurals count in PO generation #119
  • Fixed toString methods of generators in order to get the options argument #120
  • Fixed jsCode extraction bugs #121 #122

4.0.1

24 Aug 10:06
Compare
Choose a tag to compare
  • Improved phpDocs #111
  • Fixed BladeExtractor in Laravel 5.2.41 #115

3.6.1

24 Aug 10:06
Compare
Choose a tag to compare

Fixed BladeExtractor in Laravel 5.2.41 #115

4.0.0

15 Jun 18:21
Compare
Choose a tag to compare

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 to Translation::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 PhpArray has a different structure
  • Removed Gettext\Translation::normaliceTranslationCount() to improve performance
  • Removed Gettext\Translator::initGettextFunction(). Use $translator->register().
  • Invalid languages throw a InvalidArgumentException in Translations::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 $checkContent argument to Translation::hasPluralTranslations() to check whether the plural translation contains any text or not
  • Added Translations::$options to 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

27 Apr 19:16
Compare
Choose a tag to compare
  • #108 PhpCode extractor extracts also the following functions:
    • d__
    • d__e
    • dp__
    • dp__e
    • np__
    • np__e
    • dnp__
    • dnp__e
    • gettext
    • ngettext
    • pgettext
    • dgettext
    • dpgettext
    • npgettext
    • dnpgettext
  • 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__() and np__e() #103 (by @kilahm)

3.5.9

19 Feb 15:44
Compare
Choose a tag to compare

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:

  • Fixed po generation/extraction with special chars #95 #92

3.5.8

21 Jan 19:27
Compare
Choose a tag to compare
  • Fixed Jed support (#90)

3.5.7

22 Dec 10:17
Compare
Choose a tag to compare
  • Fixed error when LC_MESSAGES constant is not available #89
  • Code quality improved by @eusonlito

3.5.6

17 Nov 16:43
Compare
Choose a tag to compare
  • Fixed Gettext\Extractors\PhpCode::fromString that should return a translations instance (thanks @Repkit #87)

3.5.5

11 Nov 09:51
Compare
Choose a tag to compare

Fixed domain related global functions (d__, dp__, dnp__) #86