Skip to content
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

How do I write a given <target> on XLIFF 2.0? #8

Closed
handhikadj opened this issue Feb 8, 2021 · 13 comments
Closed

How do I write a given <target> on XLIFF 2.0? #8

handhikadj opened this issue Feb 8, 2021 · 13 comments

Comments

@handhikadj
Copy link

handhikadj commented Feb 8, 2021

I'm using okapi-lib-xliff2 to read-and-write a .xlf file which generated from OpenXLIFF's ./convert.sh. but after that, Word deems the file is corrupted when I merge the XLIFF file back using OpenXLIFF's ./merge.sh because the okapi-lib has different format of how they write-and-save the XLIFF file.

Any API/Library to write your generated .xlf file after ./convert.sh?

@rmraya
Copy link
Owner

rmraya commented Feb 8, 2021

I don't understand what your problem is. Is there anything wrong in OpenXLIFF that needs fixing?

@rmraya rmraya added question Further information is requested and removed question Further information is requested labels Feb 8, 2021
@handhikadj
Copy link
Author

handhikadj commented Feb 8, 2021

not exactly.
Here's the thing,

  1. I convert a docx file to .xlf (XLIFF 2.0) file using this library. let's call the generated .xlf file myxlf.xlf
  2. okapi-lib-xliff2 has API that can write a specific (XLIFF 2.0) without having to manually traverse/parse the myxlf.xlf file
  3. after I modify-and-save the myxlf.xlf and merge it back using this lib, Word deems the generated docx file is corrupted
  4. after I examine the myxlf.xlf, I notice that okapi-lib-xliff2overrode the .xlf to be in different format that OpenXLIFF has

So, what I need is is there any API that can write a given <target> text without manually traverse/parse the .xlf file?

I hope you can understand

@rmraya
Copy link
Owner

rmraya commented Feb 8, 2021

It seems that you have a bad XLIFF after processing. You need to fix or replace the tool that breaks the XLIFF.

OpenXLIFF already has all the code needed to read and write XLIFF files. It is the main library used by other tools like Swordfish for handling XLIFF

@handhikadj
Copy link
Author

handhikadj commented Feb 8, 2021

thank you for your ultra-fast response

yea, I know full well that the okapi-lib-xliff2 breaks your XLIFF after I examined it.
Would you tell me the tutorial how to read and write a given <target> ?

@rmraya
Copy link
Owner

rmraya commented Feb 8, 2021

There is no special tutorial.

XLIFF is XML and OpenXLIFF has XML library for reading and processing the XML, as shown in the different tools that use it.

@rmraya
Copy link
Owner

rmraya commented Feb 8, 2021

Have you reported the problem to Okapi developers?

@handhikadj
Copy link
Author

handhikadj commented Feb 8, 2021

I've just examined the .xlf file using ./xliffchecker.sh and ./xliffchecker.sh says INFO: File is valid XLIFF 2.0 after I write-a-target-and-save it
Hence I don't know what went wrong currently

@rmraya
Copy link
Owner

rmraya commented Feb 8, 2021

I can't comment if I don't see the file.

@rmraya
Copy link
Owner

rmraya commented Feb 8, 2021

BTW, why did you say that okapi breaks the XLIFF file?

@handhikadj
Copy link
Author

handhikadj commented Feb 9, 2021

you can check this out: https://gist.github.com/handhikadj/efc6a425280c8a28430eb048c12b4373#file-main-java-L94-L109
That's how okapi manipulate a .xlf file in a breeze. Notice the highlighted ones. That's how I write a given target

I can't find an API in OpenXLIFF similar to the okapi one. I hope you can provide this in the future / any time soon

@rmraya
Copy link
Owner

rmraya commented Feb 9, 2021

Your code does not handle target tags. You can have valid XLIFF but that XLIFF would be useless. Merged Word files would be broken and Word would complain when you try to open them.

Features similar to the Okapi API already exists in the tools that use OpenXLIFF. There are methods for reading, iterating, modifying, writing and saving XML files, including XLIFF, TMX, TBX, etc.

@handhikadj
Copy link
Author

would you point me out to that?

@rmraya
Copy link
Owner

rmraya commented Feb 9, 2021

Sorry, but I can't help you.

@rmraya rmraya closed this as completed Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants