feature #32548 [Translation] XliffLintCommand: allow .xliff file extension (codegain)
This PR was merged into the 4.4 branch.
Discussion
----------
[Translation] XliffLintCommand: allow .xliff file extension
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| License | MIT
I ran into a problem with XLIFF files having an *.xliff extension and a "target-language" attribute.
The command always outputted: There is a mismatch between the language included in the file name and the value used used in the "target-language" attribute of the file.
The "target-language" attribute was set to "en" and the filename was also "menu.en.xliff".
After reading the source code, I realized that this regex does not respect other valied file extensions such as "xliff" for these files and therefore throws this (rather confusing) error.
Commits
-------
dba6a21eac
[Translation] XliffLintCommand: allow .xliff file extension
This commit is contained in:
commit
d6773bc547
@ -126,7 +126,7 @@ EOF
|
|||||||
// otherwise, both '____.locale.xlf' and 'locale.____.xlf' are allowed
|
// otherwise, both '____.locale.xlf' and 'locale.____.xlf' are allowed
|
||||||
// also, the regexp matching must be case-insensitive, as defined for 'target-language' values
|
// also, the regexp matching must be case-insensitive, as defined for 'target-language' values
|
||||||
// http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#target-language
|
// http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#target-language
|
||||||
$expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.(?i:%s)\.xlf/', $normalizedLocale) : sprintf('/^(.*\.(?i:%s)\.xlf|(?i:%s)\..*\.xlf)/', $normalizedLocale, $normalizedLocale);
|
$expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.(?i:%s)\.(?:xlf|xliff)/', $normalizedLocale) : sprintf('/^(?:.*\.(?i:%s)|(?i:%s)\..*)\.(?:xlf|xliff)/', $normalizedLocale, $normalizedLocale);
|
||||||
|
|
||||||
if (0 === preg_match($expectedFilenamePattern, basename($file))) {
|
if (0 === preg_match($expectedFilenamePattern, basename($file))) {
|
||||||
$errors[] = [
|
$errors[] = [
|
||||||
|
Reference in New Issue
Block a user