-
Notifications
You must be signed in to change notification settings - Fork 127
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
Add error message for XLIFF file load (#1627) #1640
Conversation
This is one potential way to safeguard against this problem. Another could be to add a warning/exception in atom/vendor/symfony/lib/i18n/sfMessageSource.class.php Lines 193 to 201 in d996e1c
Decided to go with adding it here since generating the exception right when we're having an issue with loading the XLIFF file seemed like the more logical behaviour, but let me know if there's a better way, or a reason not to do this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion but looks good otherwise!
$xmlErrors = libxml_get_errors(); | ||
$errorMessage = ''; | ||
foreach ($xmlErrors as $error) { | ||
$errorMessage .= $error->message . '[File]: ' . $error->file . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using sprinf to assemble the error message might be cleaner, but otherwise looks solid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
86a2ca8
to
dc16920
Compare
Throwing an exception when Symfony runs into issues when loading XLIFF files. This will help with catching broken XML files due to translation errors. Without any error handling, this would lead Symfony to use an empty array as the array of translations when it is unable to read XML files, and would make it delete all existing translations for such a file.
dc16920
to
7b7ffdb
Compare
Throwing an exception when Symfony runs into issues when loading XLIFF files. This will help with catching broken XML files due to translation errors. Without any error handling, this would lead Symfony to use an empty array as the array of translations when it is unable to read XML files, and would make it delete all existing translations for such a file.