schmittjoh / JMSTranslationBundle

Puts the Symfony2 Translation Component on steroids
http://jmsyst.com/bundles/JMSTranslationBundle
426 stars 292 forks source link

XliffDumper output does not validate against xliff XSD #222

Open webberig opened 9 years ago

webberig commented 9 years ago

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...

Nyholm commented 8 years ago

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

wimvds commented 8 years ago

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.

Nyholm commented 8 years ago

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

benjamin-hubert commented 8 years ago

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)
hvt commented 7 years ago

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 commented 7 years ago

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.