-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translation] [Xliff] Support for <note> #10939
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
Conversation
@@ -33,6 +33,9 @@ protected function processDomain($domain) | |||
if ($this->target->has($id, $domain)) { | |||
$this->messages[$domain]['all'][$id] = $message; | |||
$this->result->add(array($id => $message), $domain); | |||
if (!is_null($keyMetadata = $this->source->getMetadata($id, $domain))) { |
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.
use comparison against null
instead of is_null
: if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) {
@fabpot Is metadata the right place to store I didn't found documentation about purpose of messageCatalogue's metadata, I wonder, if I should store only scalar values (as implemented: array of hash) or if I can store XliffNoteCollection containing XliffNote objects ? |
@@ -32,6 +32,9 @@ protected function processDomain($domain) | |||
foreach ($this->source->all($domain) as $id => $message) { | |||
$this->messages[$domain]['all'][$id] = $message; | |||
$this->result->add(array($id => $message), $domain); | |||
if (null !== ($keyMetadata = $this->source->getMetadata($id, $domain))) { |
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.
The parenthesis around the assignment should be removed (same below).
Looks good to me 👍 |
$catalogue->setMetadata((string) $source, array('notes' => $notes), $domain); | ||
} | ||
|
||
if (!isset($translation->target)) { |
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.
If there is no target, the translation is not added to the catalogue. does it make sense to add the metadata in such case ?
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.
You're right. Even in DiffOperation and MergeOperation the entry (and the metadata) will not be used if there is no translation
Parse XLIFF files to extract "note" property and store them into the messageCatalogue metadata
Retrieves notes from messageCatalogue metadata, and store them into xliff file
Some information contained in source catalogue (like Xliff's notes) have to be write in target catalogue.
👍 |
Thank you @jeremy-derusse. |
The purpose of this PR, is to avoid that the automated translation update (
app/console translation:update
) remove thenote
tags from XLIFF files.Not sure if using the metadata bag is a good thing or if I should have add a "note" property in MessageCatalogue. What do you think ?