JMSTranslationBundle icon indicating copy to clipboard operation
JMSTranslationBundle copied to clipboard

XliffDumper output does not validate against xliff XSD

Open webberig opened this issue 10 years ago • 6 comments

Hi,

I used this bundle to extract translations and write them to an xliff file. When I validate the file against the Xliff 1.2 XSD schema, I get a lot of errors:

[ERROR 1871] Element '{urn:jms:translation}reference-file': This element is
   not expected. Expected is ( {urn:oasis:names:tc:xliff:document:1.2}source
  ). (in file:///D:/projects/i18n/ - line 984, column 0)

This is the XSD I'm using for validation: http://docs.oasis-open.org/xliff/v1.2/cs02/xliff-core-1.2-strict.xsd

This problem also occurs when I'm using the Symfony XliffLoader, it throws the same errors because it seems to validate against the XSD as well...

webberig avatar Dec 17 '14 20:12 webberig

Thank you for reporting this. This issue is very old, do you have the same problem with the latest release?

Nyholm avatar Mar 24 '16 14:03 Nyholm

I just upgraded a project from Symfony 2.7 (via 2.8) to Symfony 3.0 and got the same error when upgrading and manually executing bin/console cache:clear. I have jms/translation-bundle 1.2.1 installed (on PHP 5.6.18) ...

IIRC I also had this issue before (in Symfony 2.7, prod environment), but then it was due to the fact that I had "jms/translation-bundle" as a dev requirement. Now it's in require, but still no luck. I can regenerate the XLIFFs using the JMS CLI commands without any error, but they can't be used by Symfony apparently. Reverted back to Symfony 2.8 hoping that that one still works. If I can find the time I'll try to look into it.

wimvds avatar Mar 30 '16 14:03 wimvds

Try with dev-master instead of 1.2.1. Also be aware of #332

Nyholm avatar Mar 30 '16 14:03 Nyholm

Also having errors with the dev-master.

[Symfony\Component\Translation\Exception\InvalidResourceException]
  Invalid resource provided: "1.2"; Errors: [ERROR 1845] Element '{urn:jms:translation}reference-file': No matching global element
   declaration available, but demanded by the strict wildcard. (in /var/www/ - line 18, column 0)
  [ERROR 1845] Element '{urn:jms:translation}reference-file': No matching global element declaration available, but demanded by th
  e strict wildcard. (in /var/www/ - line 23, column 0)
  [ERROR 1845] Element '{urn:jms:translation}reference-file': No matching global element declaration available, but demanded by th
  e strict wildcard. (in /var/www/ - line 24, column 0)
  [ERROR 1845] Element '{urn:jms:translation}reference-file': No matching global element declaration available, but demanded by th
  e strict wildcard. (in /var/www/ - line 25, column 0)

benjamin-hubert avatar Apr 07 '16 13:04 benjamin-hubert

I'm also suffering from this exact same error when upgrading from Symfony 2.3 to 2.8.

To be honest, I do not really know where this comes from exactly. Anybody got some pointers?

hvt avatar Dec 01 '16 09:12 hvt

Mmm, found it. I have three different kernels, sharing one same bundle. This bundle has JMSTranslationBundle generated XLIFF files. But only one of my kernels loaded the JMSTranslationBundle.

In these other two kernels, the default Symfony2 XLIFF loader complains (as @webberig mentioned) because there are XSD validation errors. That is because the urn:jms:translation namespace is not default.

I fixed it by also loading the JMSTranslationBundle for these other two kernels, so that JMSTranslationBundle's XLIFF loader was also used in these kernels.

hvt avatar Dec 01 '16 11:12 hvt