Hi adayzdone,
I got a mail saying you had supplied an update, but when I clicked on the link I got the following:
“Bad request. The link you followed is incorrect or outdated.”
Not sure what happened there.
There’s a second element to this script that I’d like to implement, but not sure how practical that will be. I’ll explain:
After using the XLIFF file created using the first half of this script (thanks again to adayzdone), I can translate the data contained therein and then export the final translation, which creates a new version of the XLIFF file, but in the target language.
To check that this new XLIFF file is correct and can create a viable, new language version of the original doc, I use Tikal to merge it with the format data from the original document. This is done by taking the new XLIFF file out of the target directory of the project and putting it into the source directory where the first XLIFF was created (which means I either have to delete or rename the original XLIFF file) and then running the merge function in Tikal.
I can do this move and replace step manually and then use a modified version of the script discussed here to merge things, but it would be helpful if I could automate this move and replace function. In essence, here is what I would need to do:
- CD into the source directory and either delete or rename the initial .xlf file
I tried doing this by naming the Project directory (one level above the source and target directories) as the starting point and then working from there:
set default_folder_Location to (path to home folder as text) & "Documents"
set project_location to quoted form of POSIX path of (choose folder with prompt "Folder :" default location alias default_folder_Location)
try
do shell script "cd " & project_location/source & " ; mv *.xlf *.xlf.src"
end try
This has failed - most likely due to my lack of understanding of how variables are handled between AS and shell scripts.
- Move all .xlf files from the target directory to the source directory and merge them with the formatting data from their original files:
do shell script "cd " & project_location/target & " ; mv *.xlf" & project_location/source" ; java -jar /Applications/okapi-apps_cocoa-macosx-x86_64_0.16/lib/tikal.jar -m -sl DE -tl EN *.xlf"
Again, this fails. 
If it did work, it would produce out.file_format files for each .xlf file in the directory (i.e. target_file.out.docx or target_file.out.pptx, etc.)
- Move all .xlf and .out.* files back to the target directory
do shell script "cd " & project_location/source & " ; mv *.xlf, *.out.* project_location/target"
I hope this makes sense even if so far I’ve not managed to get much of it working.
Thanks for any advice on getting this right. It would really be a time saver for me.
Bowjest