Skip to content

Add "format" to ArrayGenerator options#13

Open
mlocati wants to merge 1 commit into
php-gettext:masterfrom
mlocati-forks:arrygen-compact
Open

Add "format" to ArrayGenerator options#13
mlocati wants to merge 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
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.

1 participant