Skip to content

Add "format" to ArrayGenerator options#13

Merged
oscarotero merged 1 commit into
php-gettext:masterfrom
mlocati-forks:arrygen-compact
Jun 18, 2026
Merged

Add "format" to ArrayGenerator options#13
oscarotero merged 1 commit into
php-gettext:masterfrom
mlocati-forks:arrygen-compact

Conversation

@mlocati

@mlocati mlocati commented Jun 18, 2026

Copy link
Copy Markdown
Member

Examples:

  1. without format (or "normal" format):
    <?php return array (
      'domain' => NULL,
      'plural-forms' => 'nplurals=2; plural=n != 1;',
      'messages' => 
      array (
        '' => 
        array (
          'Foo' => 'Bar',
          'PluralKey' => 
          array (
            0 => 'One',
            1 => 'Two',
          ),
        ),
      ),
    );
  2. with "pretty" format (the old pretty option)
    <?php
    
    return [
        'domain' => null,
        'plural-forms' => 'nplurals=2; plural=n != 1;',
        'messages' => [
            '' => [
                'Foo' => 'Bar',
                'PluralKey' => [
                    'One',
                    'Two',
                ],
            ],
        ],
    ];
  3. with the new "compact" format
    <?php return ['domain'=>null,'plural-forms'=>'nplurals=2; plural=n != 1;','messages'=>[''=>['Foo'=>'Bar','PluralKey'=>['One','Two']]]];

The deprecated "pretty" option can be passed as
'format' => 'pretty'

Let's introduce a new 'compact' format
@oscarotero oscarotero merged commit 807ba2c into php-gettext:master Jun 18, 2026
9 checks passed
@mlocati mlocati deleted the arrygen-compact branch June 19, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants