Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TranslatorTest.php

function TranslatorTest::getChooseTests

File

vendor/symfony/translation-contracts/Test/TranslatorTest.php, line 203

Class

TranslatorTest
Test should cover all languages mentioned on http://translate.sourceforge.net/wiki/l10n/pluralforms and Plural forms mentioned on http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms.

Namespace

Symfony\Contracts\Translation\Test

Code

public static function getChooseTests() {
    return [
        [
            'There are no apples',
            '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples',
            0,
        ],
        [
            'There are no apples',
            '{0}     There are no apples|{1} There is one apple|]1,Inf] There are %count% apples',
            0,
        ],
        [
            'There are no apples',
            '{0}There are no apples|{1} There is one apple|]1,Inf] There are %count% apples',
            0,
        ],
        [
            'There is one apple',
            '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples',
            1,
        ],
        [
            'There are 10 apples',
            '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples',
            10,
        ],
        [
            'There are 10 apples',
            '{0} There are no apples|{1} There is one apple|]1,Inf]There are %count% apples',
            10,
        ],
        [
            'There are 10 apples',
            '{0} There are no apples|{1} There is one apple|]1,Inf]     There are %count% apples',
            10,
        ],
        [
            'There are 0 apples',
            'There is one apple|There are %count% apples',
            0,
        ],
        [
            'There is one apple',
            'There is one apple|There are %count% apples',
            1,
        ],
        [
            'There are 10 apples',
            'There is one apple|There are %count% apples',
            10,
        ],
        [
            'There are 0 apples',
            'one: There is one apple|more: There are %count% apples',
            0,
        ],
        [
            'There is one apple',
            'one: There is one apple|more: There are %count% apples',
            1,
        ],
        [
            'There are 10 apples',
            'one: There is one apple|more: There are %count% apples',
            10,
        ],
        [
            'There are no apples',
            '{0} There are no apples|one: There is one apple|more: There are %count% apples',
            0,
        ],
        [
            'There is one apple',
            '{0} There are no apples|one: There is one apple|more: There are %count% apples',
            1,
        ],
        [
            'There are 10 apples',
            '{0} There are no apples|one: There is one apple|more: There are %count% apples',
            10,
        ],
        [
            '',
            '{0}|{1} There is one apple|]1,Inf] There are %count% apples',
            0,
        ],
        [
            '',
            '{0} There are no apples|{1}|]1,Inf] There are %count% apples',
            1,
        ],
        // Indexed only tests which are Gettext PoFile* compatible strings.
[
            'There are 0 apples',
            'There is one apple|There are %count% apples',
            0,
        ],
        [
            'There is one apple',
            'There is one apple|There are %count% apples',
            1,
        ],
        [
            'There are 2 apples',
            'There is one apple|There are %count% apples',
            2,
        ],
        // Tests for float numbers
[
            'There is almost one apple',
            '{0} There are no apples|]0,1[ There is almost one apple|{1} There is one apple|[1,Inf] There is more than one apple',
            0.7,
        ],
        [
            'There is one apple',
            '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple',
            1,
        ],
        [
            'There is more than one apple',
            '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple',
            1.7,
        ],
        [
            'There are no apples',
            '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple',
            0,
        ],
        [
            'There are no apples',
            '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple',
            0.0,
        ],
        [
            'There are no apples',
            '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple',
            0,
        ],
        // Test texts with new-lines
        // with double-quotes and \n in id & double-quotes and actual newlines in text
[
            "This is a text with a\n            new-line in it. Selector = 0.",
            '{0}This is a text with a
            new-line in it. Selector = 0.|{1}This is a text with a
            new-line in it. Selector = 1.|[1,Inf]This is a text with a
            new-line in it. Selector > 1.',
            0,
        ],
        // with double-quotes and \n in id and single-quotes and actual newlines in text
[
            "This is a text with a\n            new-line in it. Selector = 1.",
            '{0}This is a text with a
            new-line in it. Selector = 0.|{1}This is a text with a
            new-line in it. Selector = 1.|[1,Inf]This is a text with a
            new-line in it. Selector > 1.',
            1,
        ],
        [
            "This is a text with a\n            new-line in it. Selector > 1.",
            '{0}This is a text with a
            new-line in it. Selector = 0.|{1}This is a text with a
            new-line in it. Selector = 1.|[1,Inf]This is a text with a
            new-line in it. Selector > 1.',
            5,
        ],
        // with double-quotes and id split across lines
[
            'This is a text with a
            new-line in it. Selector = 1.',
            '{0}This is a text with a
            new-line in it. Selector = 0.|{1}This is a text with a
            new-line in it. Selector = 1.|[1,Inf]This is a text with a
            new-line in it. Selector > 1.',
            1,
        ],
        // with single-quotes and id split across lines
[
            'This is a text with a
            new-line in it. Selector > 1.',
            '{0}This is a text with a
            new-line in it. Selector = 0.|{1}This is a text with a
            new-line in it. Selector = 1.|[1,Inf]This is a text with a
            new-line in it. Selector > 1.',
            5,
        ],
        // with single-quotes and \n in text
[
            'This is a text with a\\nnew-line in it. Selector = 0.',
            '{0}This is a text with a\\nnew-line in it. Selector = 0.|{1}This is a text with a\\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\\nnew-line in it. Selector > 1.',
            0,
        ],
        // with double-quotes and id split across lines
[
            "This is a text with a\nnew-line in it. Selector = 1.",
            "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.",
            1,
        ],
        // escape pipe
[
            'This is a text with | in it. Selector = 0.',
            '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.',
            0,
        ],
        // Empty plural set (2 plural forms) from a .PO file
[
            '',
            '|',
            1,
        ],
        // Empty plural set (3 plural forms) from a .PO file
[
            '',
            '||',
            1,
        ],
        // Floating values
[
            '1.5 liters',
            '%count% liter|%count% liters',
            1.5,
        ],
        [
            '1.5 litre',
            '%count% litre|%count% litres',
            1.5,
            'fr',
        ],
        // Negative values
[
            '-1 degree',
            '%count% degree|%count% degrees',
            -1,
        ],
        [
            '-1 degré',
            '%count% degré|%count% degrés',
            -1,
        ],
        [
            '-1.5 degrees',
            '%count% degree|%count% degrees',
            -1.5,
        ],
        [
            '-1.5 degré',
            '%count% degré|%count% degrés',
            -1.5,
            'fr',
        ],
        [
            '-2 degrees',
            '%count% degree|%count% degrees',
            -2,
        ],
        [
            '-2 degrés',
            '%count% degré|%count% degrés',
            -2,
        ],
    ];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal