Skip to content

Commit d999431

Browse files
committed
1 parent 3ad8fcd commit d999431

14 files changed

+535
-535
lines changed

Command/TranslationLintCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ protected function configure(): void
5454
new InputOption('locale', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Specify the locales to lint.', $this->enabledLocales),
5555
])
5656
->setHelp(<<<'EOF'
57-
The <info>%command.name%</> command lint translations.
57+
The <info>%command.name%</> command lint translations.
5858
59-
<info>php %command.full_name%</>
60-
EOF
59+
<info>php %command.full_name%</>
60+
EOF
6161
);
6262
}
6363

Command/TranslationPullCommand.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,21 @@ protected function configure(): void
9090
new InputOption('as-tree', null, InputOption::VALUE_REQUIRED, 'Write messages as a tree-like structure. Needs --format=yaml. The given value defines the level where to switch to inline YAML'),
9191
])
9292
->setHelp(<<<'EOF'
93-
The <info>%command.name%</> command pulls translations from the given provider. Only
94-
new translations are pulled, existing ones are not overwritten.
93+
The <info>%command.name%</> command pulls translations from the given provider. Only
94+
new translations are pulled, existing ones are not overwritten.
9595
96-
You can overwrite existing translations (and remove the missing ones on local side) by using the <comment>--force</> flag:
96+
You can overwrite existing translations (and remove the missing ones on local side) by using the <comment>--force</> flag:
9797
98-
<info>php %command.full_name% --force provider</>
98+
<info>php %command.full_name% --force provider</>
9999
100-
Full example:
100+
Full example:
101101
102-
<info>php %command.full_name% provider --force --domains=messages --domains=validators --locales=en</>
102+
<info>php %command.full_name% provider --force --domains=messages --domains=validators --locales=en</>
103103
104-
This command pulls all translations associated with the <comment>messages</> and <comment>validators</> domains for the <comment>en</> locale.
105-
Local translations for the specified domains and locale are deleted if they're not present on the provider and overwritten if it's the case.
106-
Local translations for others domains and locales are ignored.
107-
EOF
104+
This command pulls all translations associated with the <comment>messages</> and <comment>validators</> domains for the <comment>en</> locale.
105+
Local translations for the specified domains and locale are deleted if they're not present on the provider and overwritten if it's the case.
106+
Local translations for others domains and locales are ignored.
107+
EOF
108108
)
109109
;
110110
}

Command/TranslationPushCommand.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,25 @@ protected function configure(): void
8181
new InputOption('locales', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Specify the locales to push.', $this->enabledLocales),
8282
])
8383
->setHelp(<<<'EOF'
84-
The <info>%command.name%</> command pushes translations to the given provider. Only new
85-
translations are pushed, existing ones are not overwritten.
84+
The <info>%command.name%</> command pushes translations to the given provider. Only new
85+
translations are pushed, existing ones are not overwritten.
8686
87-
You can overwrite existing translations by using the <comment>--force</> flag:
87+
You can overwrite existing translations by using the <comment>--force</> flag:
8888
89-
<info>php %command.full_name% --force provider</>
89+
<info>php %command.full_name% --force provider</>
9090
91-
You can delete provider translations which are not present locally by using the <comment>--delete-missing</> flag:
91+
You can delete provider translations which are not present locally by using the <comment>--delete-missing</> flag:
9292
93-
<info>php %command.full_name% --delete-missing provider</>
93+
<info>php %command.full_name% --delete-missing provider</>
9494
95-
Full example:
95+
Full example:
9696
97-
<info>php %command.full_name% provider --force --delete-missing --domains=messages --domains=validators --locales=en</>
97+
<info>php %command.full_name% provider --force --delete-missing --domains=messages --domains=validators --locales=en</>
9898
99-
This command pushes all translations associated with the <comment>messages</> and <comment>validators</> domains for the <comment>en</> locale.
100-
Provider translations for the specified domains and locale are deleted if they're not present locally and overwritten if it's the case.
101-
Provider translations for others domains and locales are ignored.
102-
EOF
99+
This command pushes all translations associated with the <comment>messages</> and <comment>validators</> domains for the <comment>en</> locale.
100+
Provider translations for the specified domains and locale are deleted if they're not present locally and overwritten if it's the case.
101+
Provider translations for others domains and locales are ignored.
102+
EOF
103103
)
104104
;
105105
}

Command/XliffLintCommand.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,26 @@ protected function configure(): void
5858
->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN')
5959
->addOption('format', null, InputOption::VALUE_REQUIRED, \sprintf('The output format ("%s")', implode('", "', $this->getAvailableFormatOptions())))
6060
->setHelp(<<<EOF
61-
The <info>%command.name%</info> command lints an XLIFF file and outputs to STDOUT
62-
the first encountered syntax error.
61+
The <info>%command.name%</info> command lints an XLIFF file and outputs to STDOUT
62+
the first encountered syntax error.
6363
64-
You can validates XLIFF contents passed from STDIN:
64+
You can validates XLIFF contents passed from STDIN:
6565
66-
<info>cat filename | php %command.full_name% -</info>
66+
<info>cat filename | php %command.full_name% -</info>
6767
68-
You can also validate the syntax of a file:
68+
You can also validate the syntax of a file:
6969
70-
<info>php %command.full_name% filename</info>
70+
<info>php %command.full_name% filename</info>
7171
72-
Or of a whole directory:
72+
Or of a whole directory:
7373
74-
<info>php %command.full_name% dirname</info>
74+
<info>php %command.full_name% dirname</info>
7575
76-
The <info>--format</info> option specifies the format of the command output:
76+
The <info>--format</info> option specifies the format of the command output:
7777
78-
<info>php %command.full_name% dirname --format=json</info>
78+
<info>php %command.full_name% dirname --format=json</info>
7979
80-
EOF
80+
EOF
8181
)
8282
;
8383
}

Dumper/PoFileDumper.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,22 @@ private function getStandardRules(string $id): array
7676
}
7777

7878
$intervalRegexp = <<<'EOF'
79-
/^(?P<interval>
80-
({\s*
81-
(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)
82-
\s*})
83-
84-
|
85-
86-
(?P<left_delimiter>[\[\]])
87-
\s*
88-
(?P<left>-Inf|\-?\d+(\.\d+)?)
89-
\s*,\s*
90-
(?P<right>\+?Inf|\-?\d+(\.\d+)?)
91-
\s*
92-
(?P<right_delimiter>[\[\]])
93-
)\s*(?P<message>.*?)$/xs
94-
EOF;
79+
/^(?P<interval>
80+
({\s*
81+
(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)
82+
\s*})
83+
84+
|
85+
86+
(?P<left_delimiter>[\[\]])
87+
\s*
88+
(?P<left>-Inf|\-?\d+(\.\d+)?)
89+
\s*,\s*
90+
(?P<right>\+?Inf|\-?\d+(\.\d+)?)
91+
\s*
92+
(?P<right_delimiter>[\[\]])
93+
)\s*(?P<message>.*?)$/xs
94+
EOF;
9595

9696
$standardRules = [];
9797
foreach ($parts as $part) {

Resources/bin/translation-status.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@
1515

1616
$usageInstructions = <<<END
1717
18-
Usage instructions
19-
-------------------------------------------------------------------------------
18+
Usage instructions
19+
-------------------------------------------------------------------------------
2020
21-
$ cd symfony-code-root-directory/
21+
$ cd symfony-code-root-directory/
2222
23-
# show the translation status of all locales
24-
$ php translation-status.php
23+
# show the translation status of all locales
24+
$ php translation-status.php
2525
26-
# only show the translation status of incomplete or erroneous locales
27-
$ php translation-status.php --incomplete
26+
# only show the translation status of incomplete or erroneous locales
27+
$ php translation-status.php --incomplete
2828
29-
# show the translation status of all locales, all their missing translations and mismatches between trans-unit id and source
30-
$ php translation-status.php -v
29+
# show the translation status of all locales, all their missing translations and mismatches between trans-unit id and source
30+
$ php translation-status.php -v
3131
32-
# show the status of a single locale
33-
$ php translation-status.php fr
32+
# show the status of a single locale
33+
$ php translation-status.php fr
3434
35-
# show the status of a single locale, missing translations and mismatches between trans-unit id and source
36-
$ php translation-status.php fr -v
35+
# show the status of a single locale, missing translations and mismatches between trans-unit id and source
36+
$ php translation-status.php fr -v
3737
38-
END;
38+
END;
3939

4040
$config = [
4141
// if TRUE, the full list of missing translations is displayed

Tests/Command/TranslationLintCommandTest.php

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ public function testLintCorrectTranslations()
3131
$translator->addResource('array', [
3232
'hello_name' => 'Hello {name}!',
3333
'num_of_apples' => <<<ICU
34-
{apples, plural,
35-
=0 {There are no apples}
36-
=1 {There is one apple...}
37-
other {There are # apples!}
38-
}
39-
ICU,
34+
{apples, plural,
35+
=0 {There are no apples}
36+
=1 {There is one apple...}
37+
other {There are # apples!}
38+
}
39+
ICU,
4040
], 'en', 'messages+intl-icu');
4141
$translator->addResource('array', ['hello' => 'Bonjour !'], 'fr', 'messages');
4242
$translator->addResource('array', [
4343
'hello_name' => 'Bonjour {name} !',
4444
'num_of_apples' => <<<ICU
45-
{apples, plural,
46-
=0 {Il n'y a pas de pommes}
47-
=1 {Il y a une pomme}
48-
other {Il y a # pommes !}
49-
}
50-
ICU,
45+
{apples, plural,
46+
=0 {Il n'y a pas de pommes}
47+
=1 {Il y a une pomme}
48+
other {Il y a # pommes !}
49+
}
50+
ICU,
5151
], 'fr', 'messages+intl-icu');
5252

5353
$command = $this->createCommand($translator, ['en', 'fr']);
@@ -71,24 +71,24 @@ public function testLintMalformedIcuTranslations()
7171
'hello_name' => 'Hello {name}!',
7272
// Missing "other" case
7373
'num_of_apples' => <<<ICU
74-
{apples, plural,
75-
=0 {There are no apples}
76-
=1 {There is one apple...}
77-
}
78-
ICU,
74+
{apples, plural,
75+
=0 {There are no apples}
76+
=1 {There is one apple...}
77+
}
78+
ICU,
7979
], 'en', 'messages+intl-icu');
8080
$translator->addResource('array', ['hello' => 'Bonjour !'], 'fr', 'messages');
8181
$translator->addResource('array', [
8282
// Missing "}"
8383
'hello_name' => 'Bonjour {name !',
8484
// "other" is translated
8585
'num_of_apples' => <<<ICU
86-
{apples, plural,
87-
=0 {Il n'y a pas de pommes}
88-
=1 {Il y a une pomme}
89-
autre {Il y a # pommes !}
90-
}
91-
ICU,
86+
{apples, plural,
87+
=0 {Il n'y a pas de pommes}
88+
=1 {Il y a une pomme}
89+
autre {Il y a # pommes !}
90+
}
91+
ICU,
9292
], 'fr', 'messages+intl-icu');
9393

9494
$command = $this->createCommand($translator, ['en', 'fr']);
@@ -98,53 +98,53 @@ public function testLintMalformedIcuTranslations()
9898

9999
$display = $this->getNormalizedDisplay($commandTester);
100100
$this->assertStringContainsString(<<<EOF
101-
-------- ---------- --------
102-
Locale Domains Valid?
103-
-------- ---------- --------
104-
en messages No
105-
fr messages No
106-
-------- ---------- --------
107-
EOF, $display);
101+
-------- ---------- --------
102+
Locale Domains Valid?
103+
-------- ---------- --------
104+
en messages No
105+
fr messages No
106+
-------- ---------- --------
107+
EOF, $display);
108108
$this->assertStringContainsString(\sprintf(<<<EOF
109-
Errors for locale "en" and domain "messages"
110-
--------------------------------------------
109+
Errors for locale "en" and domain "messages"
110+
--------------------------------------------
111111
112-
Translation key "num_of_apples" is invalid:
112+
Translation key "num_of_apples" is invalid:
113113
114-
[ERROR] Invalid message format (error #65807): %s: message formatter creation failed:
115-
U_DEFAULT_KEYWORD_MISSING
116-
EOF, \PHP_VERSION_ID >= 80500 ? 'MessageFormatter::__construct()' : 'msgfmt_create'), $display);
114+
[ERROR] Invalid message format (error #65807): %s: message formatter creation failed:
115+
U_DEFAULT_KEYWORD_MISSING
116+
EOF, \PHP_VERSION_ID >= 80500 ? 'MessageFormatter::__construct()' : 'msgfmt_create'), $display);
117117

118118
if (\PHP_VERSION_ID >= 80500) {
119119
$this->assertStringContainsString(<<<EOF
120-
Errors for locale "fr" and domain "messages"
121-
--------------------------------------------
120+
Errors for locale "fr" and domain "messages"
121+
--------------------------------------------
122122
123-
Translation key "hello_name" is invalid:
123+
Translation key "hello_name" is invalid:
124124
125-
[ERROR] Invalid message format (error #65799): MessageFormatter::__construct(): pattern syntax error (parse error at
126-
offset 9, after "Bonjour {", before or at "name !"): U_PATTERN_SYNTAX_ERROR
125+
[ERROR] Invalid message format (error #65799): MessageFormatter::__construct(): pattern syntax error (parse error at
126+
offset 9, after "Bonjour {", before or at "name !"): U_PATTERN_SYNTAX_ERROR
127127
128-
Translation key "num_of_apples" is invalid:
128+
Translation key "num_of_apples" is invalid:
129129
130-
[ERROR] Invalid message format (error #65807): MessageFormatter::__construct(): message formatter creation failed:
131-
U_DEFAULT_KEYWORD_MISSING
132-
EOF, $display);
130+
[ERROR] Invalid message format (error #65807): MessageFormatter::__construct(): message formatter creation failed:
131+
U_DEFAULT_KEYWORD_MISSING
132+
EOF, $display);
133133
} else {
134134
$this->assertStringContainsString(<<<EOF
135-
Errors for locale "fr" and domain "messages"
136-
--------------------------------------------
135+
Errors for locale "fr" and domain "messages"
136+
--------------------------------------------
137137
138-
Translation key "hello_name" is invalid:
138+
Translation key "hello_name" is invalid:
139139
140-
[ERROR] Invalid message format (error #65799): pattern syntax error (parse error at offset 9, after "Bonjour {", before
141-
or at "name !"): U_PATTERN_SYNTAX_ERROR
140+
[ERROR] Invalid message format (error #65799): pattern syntax error (parse error at offset 9, after "Bonjour {", before
141+
or at "name !"): U_PATTERN_SYNTAX_ERROR
142142
143-
Translation key "num_of_apples" is invalid:
143+
Translation key "num_of_apples" is invalid:
144144
145-
[ERROR] Invalid message format (error #65807): msgfmt_create: message formatter creation failed:
146-
U_DEFAULT_KEYWORD_MISSING
147-
EOF, $display);
145+
[ERROR] Invalid message format (error #65807): msgfmt_create: message formatter creation failed:
146+
U_DEFAULT_KEYWORD_MISSING
147+
EOF, $display);
148148
}
149149
}
150150

0 commit comments

Comments
 (0)