Skip to content

Improved the lint:xliff command #26682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2018
Merged

Conversation

javiereguiluz
Copy link
Member

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #26537
License MIT
Doc PR -

This is how it looks:

lint-xliff-output

@@ -242,4 +254,16 @@ private function isReadable($fileOrDirectory)

return $default($fileOrDirectory);
}

private function getTargetLanguageFromFile($xliffContents)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    private function getTargetLanguageFromFile(\DOMDocument $xliffContents): ?string
    {
        foreach ($xliffContents->getElementsByTagName('file')[0]->attributes ?? array() as $attribute) {
            if ('target-language' === $attribute->nodeName) {
                return $attribute->nodeValue;
            }
        }

        return null;
    }

}

if (false === $document->schemaValidate(__DIR__.'/../Resources/schemas/xliff-core-1.2-strict.xsd')) {
$errors[] = array_map(function ($error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure about it ? This will add an array of errors a a single entry in $errors. This looks weird to me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, your new test does not seem to cover this code path


libxml_clear_errors();
libxml_use_internal_errors(false);

return array('file' => $file, 'valid' => false, 'messages' => $errorMessages);
return array('file' => $file, 'valid' => empty($errors), 'messages' => $errors);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you avoid using empty() here?

javiereguiluz added a commit to symfony/demo that referenced this pull request Mar 28, 2018
This PR was merged into the master branch.

Discussion
----------

Fixed minor issues in the XLIFF files

Spotted thanks to the latest improvement of `lint:xliff`: symfony/symfony#26682

Commits
-------

2020233 Fixed minor issues in the XLIFF files
*
* @author Javier Eguiluz <javier.eguiluz@gmail.com>
*/
class XliffLintCommandTest extends TestCase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should go in the component, as the command is in the component (well, we may need to have 2 different tests). This should fix the deps=low build too, by having the test for the new feature in the same package than the feature itself.

@fabpot
Copy link
Member

fabpot commented Mar 30, 2018

Thank you @javiereguiluz.

@fabpot fabpot closed this Mar 30, 2018
@fabpot fabpot merged commit 6bbcc45 into symfony:master Mar 30, 2018
fabpot added a commit that referenced this pull request Mar 30, 2018
This PR was squashed before being merged into the 4.1-dev branch (closes #26682).

Discussion
----------

Improved the lint:xliff command

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26537
| License       | MIT
| Doc PR        | -

This is how it looks:

![lint-xliff-output](https://user-images.githubusercontent.com/73419/37958502-fd8732e0-31b0-11e8-8688-8644ca930daf.png)

Commits
-------

6bbcc45 Improved the lint:xliff command
@fabpot fabpot mentioned this pull request May 7, 2018
sayjun0505 added a commit to sayjun0505/sym_proj that referenced this pull request Apr 16, 2023
This PR was merged into the master branch.

Discussion
----------

Fixed minor issues in the XLIFF files

Spotted thanks to the latest improvement of `lint:xliff`: symfony/symfony#26682

Commits
-------

2020233 Fixed minor issues in the XLIFF files
spider-yamet added a commit to spider-yamet/sym_proj that referenced this pull request Apr 16, 2023
This PR was merged into the master branch.

Discussion
----------

Fixed minor issues in the XLIFF files

Spotted thanks to the latest improvement of `lint:xliff`: symfony/symfony#26682

Commits
-------

2020233 Fixed minor issues in the XLIFF files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants