Skip navigation
Currently Being Moderated

Extract text from illustrator for translation then replace with translated text

Jan 4, 2011 10:01 AM

I am trying to find a way to expedite translations of our drawings.  Each drawing has a series of callouts showing what that piece of the drawing is via text.  I would need to do 100's of drawings for each book.

 

Questions:

 

1. Can I write something to batch a folder and extract the name of the file, and the text from each textbox so that when I get the translation back, I can automate the reinsertion of the translated text to its correct field (i.e. TextField1 = "Translate this" then repopulate that same exact field with "Translation")?  In order to do this I would think each text field would have to be tagged with some unique identifier so that it would know which translation goes where in the drawing.  Keep in mind, I'm ok with manually tagging each textbox if necessary.

 

2. Assuming the above is possible, what would be the best program to write the extracted text to so that reading and writing the translated text back into the drawing is as easy as possible (i.e. Word, Excel, PDF)?

 
Replies
  • Currently Being Moderated
    Jan 4, 2011 11:19 AM   in reply to Cpriddy

    That can be accomplished with Data Sets.

     

    look here http://forums.adobe.com/message/3067221#3067221

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 4, 2011 2:11 PM   in reply to Cpriddy

    scripting is not necessary, but it could be used, let's say your art has a 100 pices of text all in English, you select one at a time and make it dynamic (make variable1, variable2...variable100). Once you have all your variables, you capture a Data Set, export that data set (an xml file, like BilingualText.xml), then modifie the xml to include your translated text and import back to Illustrator. Now you will be abel to switch between English and the translation.

     

    or if you don't need to switch between languages, just export the file as something like English.xml, then have it translated and saved as Spanish.xml for example and load the file each time its needed.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 4, 2011 4:10 PM   in reply to Cpriddy

    you're welcome, just do a quick test with 2 or 3 text Frames, save the xml file, edit it yourself and import it back to illustrator to see how it works. Post back if you need help.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 5, 2011 6:13 AM   in reply to Cpriddy

    This was my thoughts… on your situation… With what you have to do I saw little or no advantage to using XML… unless you have an automated way in which to generate it (directly from Excel perhaps?). I've never done this… I've tried several times but Illustrator is very particular over the XML formating and I've never resolved the issue. If this were my job to do then I would write the required info out to text file. For use in Excel or FMP, add the translations then save back out to text for reading back into the files. I don't do VB but may have 'some' time to look at this in JavaScript which will work on either platform…

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 5, 2011 10:39 AM   in reply to Cpriddy

    too bad Data Sets didn't work for your project.

     

    back to square one, scripting sample using VBA

    translate1.PNG

    Sub translate()
        Dim iapp As New Illustrator.Application
        Dim idoc As Illustrator.Document
        
        Dim tFrame As Illustrator.TextFrame
        rou = 1
        colum = 3 'read
        'colum = 4 'write
        Set idoc = iapp.ActiveDocument
        
        For Each tFrame In idoc.TextFrames
            Cells(rou, colum) = tFrame.Contents 'read
            'tFrame.Contents = Cells(rou, colum) 'write
            rou = rou + 1
        Next
        
        Set fFrame = Nothing
        Set idoc = Nothing
        Set iapp = Nothing
    End Sub
    

     

    text frames contents are read into column C, translation into column D

    translate2.PNG

    then back to Illustrator

    translate3.PNG

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 5, 2011 11:05 AM   in reply to Cpriddy

    oh sorry, the sample doesn't check for errors, it assumes there's an open Excel book and an open Illustrator Document with some text in it.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 5, 2011 11:37 AM   in reply to Cpriddy

    no need for text IDs, the code will loop thru the text fields from top to bottom in the stacking order (see the layer screen shot).

     

    if you plan to do 1 excel file againg 100s of Illustrator files, it gets a little more complicated

     

    - loop thru all illustrator files in a folder, open one at the time and

         - get name

         - write name in column A

         - loop thru all text, write in column B

         - close file when done

         - open next file, repeat

     

    I would then write a separate procedure for writing back to illustrator

     

         - read file name from column A

         - open file

         - loop thru all text, in column C

         - write back to illustrator

         - check for file name in column A

         - repeat while column A is still the opened IL file

         - when column A finds a new file

         - close file

         - open next file

         - repeat

     

    wow...that looks like a bigger project

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 5, 2011 12:02 PM   in reply to Cpriddy

    you're welcome

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 27, 2011 5:36 AM   in reply to CarlosCanto

    Hello,

     

    We have more and less the same issue here while it's a bit more complex as we have several languages on the same packaging. Moreover, we have different text sources that would require to be translated in different sets of languages.

     

    I have already looked in the data set and I tried to get familiar with it. I'm just wondering if someone has a good idea on how to create the data set knowing that there are different source texts for a particular region (region means a set of languages) and other texts for another region... The idea is to export this into one XML file with well identified elements that can be split with a tool, sent for translation according to their region then merged back into one single file.

     

    Region 1:

    en-US

    text 1

    text 2

     

    fr-FR

    text 1

    text 2

     

    de-DE

    etc...

     

    Region 2:

    en-US

    text 3

    text 4

     

    ru-RU

    text 3

    text 4

     

    Region 3:

    etc..

     

    I hope someone will be able to give me some help,

    François

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 2, 2013 12:56 PM   in reply to keskifo

    I use a tool called Sysfilter for Illustrator  for conversions to XML and translation... This should also work.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points