locize / xliff

xliff2js and js2xliff converter xliff utils
MIT License
80 stars 37 forks source link

Support for multiple <segment>s #22

Closed kaidjohnson closed 2 years ago

kaidjohnson commented 5 years ago

Thanks for this library! Very useful!

I noticed a few features in the XLIFF 2.0 spec (http://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html) that do not appear to be implemented, namely the use of multiple <segment> entries. Any thoughts around if this feature may be supported in the future?

As a workaround for now, we can combine our <segment>s into a single <segment>, but would be nice to continue to maintain multiple in the future.

adrai commented 5 years ago

Currently there is/was no need for this. Do you have an idea how a json file could look like? Btw: if you want to contribute, feel free to suggest a PR

ph-fritsche commented 3 years ago

I just stumbled over this in a project. What do you think about this?

<unit id="foo">
  <segment>
   <source>some source paragraph</source>
   <target>some target paragraph</target>
  </segment>
  <segment>
   <source>another source paragraph</source>
   <source>another target paragraph</target>
  </segment>
</unit>

through xliff2js and targetOfjs this could produce

foo: [
  "some target paragraph",
  "another target paragraph",
]

This would allow to use this e.g. in React like this:

<div>{t('foo').map(t => <p>{t}</p>)}</div>
adrai commented 3 years ago

Feel free to try a PR.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.