-
-
Notifications
You must be signed in to change notification settings - Fork 135
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 support for XLIFF unit IDs #221
Conversation
Hi, thanks for your contribution.
Does it means a translator can returns multiple translations for the same id? What is the point? |
:) I agree -- I like my IDs unique. But check in 4.3.1.21 at http://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html#d0e4784:
So by my read, other non- |
In that case, I guess a Please, give some time and I let you know. |
I think
|
...and of course, obviously, enjoy your vacation! This can wait until you're back. |
Hi @oscarotero! Got any feedback on whether/how we could add XLIFF group IDs non-disruptively to Gettext? |
Hi, @asmecher I don't like to add a new different All formats should be compatible with gettext and specifically, the .po format in some way, in order to preserve all data on import/export to other formats. (The name of this library is Gettext, so we should give priority to it :) Due UnitId is not equivalent to msgid, because it's not required to be unique, a solution could be save the value in a comment. For example: $translation->addComment("XLIFF_UNIT_ID: {$unitId}"); So, in a .po file, it'd be saved in this way: # XLIFF_UNIT_ID: foo
msgid "Foo"
msgstr "Bar" And the Xliff generator could search the UnitId in the comments or generate one automatically if it hasn't found it. What do you think? |
Thanks for the feedback, @oscarotero. I've changed the implementation of the feature to suit what you've suggested; if that looks good, I'll add test coverage for it too. One remaining question: do you foresee a function on the |
@asmecher Thanks! //Get the unitID if exists
$unitID = Gettext\Generators\Xlif::getUnitID($translation); |
Thanks, @oscarotero -- I've added some changes per your comments above, plus a test case for XLIFF showing correct reading of the custom unit IDs and their preservation into PO. |
Excellent, thanks, @oscarotero! Do you have a date in mind for a release that includes this? |
This is the "least-invasive" way to add unit IDs to the existing toolset, without potentially introducing problems with uniqueness (XLIFF doesn't require uniqueness of IDs in any way).