Homework -> Homework #4 - Part 2: Finishing Translation & Web Scripting

Homework #4 - Part 2 is designed to teach you to work with text which is deeply hidden in the website code and not obviously translatable at first glance.
This type of content is extremely common in web formats and requires
more intensive searching and careful handling.

PART 1 - Finding translatable content in HTML attributes --- ALL FILES

    TAG ATTRIBUTES WHICH CONTAIN TRANSLATABLE TEXT

    ATTRIBUTE NAME COMMON TAGS
    THAT USE THE ATTRIBUTE
    EXAMPLE
    alt <img ...> <img alt= "translate me"...>
    value <input ...> <input value= "translate me"...>
    content <meta ...>
    (ONLY if accompanied by attributes "keywords" or "content")
    <meta name="keywords" content= "translate me"...>
  1. You should have already translated and saved all the files from within the Folder List except for destination_settings.php
  2. Close all of the files in "Expression Web" if they are still open
    • Note: You can close multiple files at once via the top menu under Window > Close All Pages
  3. You now need to search for translatable attributes within tags.
  4. In the top menu, go to Edit > Find...the Find and Replace dialog will appear
    1. Under Find what: type in the first attribute listed in the green box above. Include an equals sign following the attribute name.
      • EXAMPLE: Finding "alt" attributes:
    2. Under Find where: select All pages
    3. Under Advanced: check the box Find in source code
    4. Click Find All
  5. Results from a search for any of the above will appear in the Find 1 box at the bottom of the editor pane
  6. Double-click on the first result in the list, you will be taken to the exact location of your search result within the code
  7. Translate the attribute (it will always be between double quotes) making sure not to:
    • overwrite any other content
    • accidentally delete one or both of the quotation marks
  8. Repeat step #6 & #7 for the remaining results in the Find 1 list until completed
  9. Search for the next attribute in the list above (repeating steps #4-8)
  10. Continue to search and translate until complete

PART 2 - Locating and translating content in scripting code (a.k.a. "hardcoded strings") --- form.htm

    SCRIPTING CODE WHICH OFTEN CONTAINS TRANSLATABLE TEXT

    alert("I might be translatable text.")
    prompt("I might be translatable text.")
    confirm("I might be translatable text.")
    document.write("I might be translatable text.")
    response = "I might be translatable text."
    window.status="I might be translatable text."
    strNameOfAVariable = "I might be translatable text."
    msgNameOfAVariable = "I might be translatable text."

    These are most often found in registration forms, search pages, or anywhere where the person on the other end of the web browser is expected to interact with the webpage via buttons, text fields, dropdown lists, etc.

  1. Close and save all of the files that you opened in PART 1
    • Note: You can close multiple files at once via the top menu under Window > Close All Pages
  2. In the top menu, go to Edit > Find...the Find and Replace dialog will appear
    1. Under Find what: type in one of the scripting codes from the green box above (marked with bold blue). These indicate the possible presence of translatable strings embedded deeply in the code.
    2. Under Find where: select All pages
    3. Under Advanced: check the box Find in source code
    4. Click Find All
  3. If results pop up from a search for any of the above, they will appear in the Find 1 box at the bottom of the editor pane
  4. Look carefully through the list. You'll notice that form.htm is the file with the most potential translatable scripting
  5. Double-click on a message you think is translatable from the Find 1 box
  6. form.htm will open in the editor pane and you will be taken to the exact location of your search result within the file
  7. Search through form.htm for similar messages. You can likely find a pattern if you pay close attention but don't start translating yet!
  8. Once you are fairly confident you have found translatable content, take a look at form.htm running in a web browser by going to File > Preview in Browser... > [browser name] (1024 x768).
    1. Press the "Submit" button on the page to see a message pop up. Fill out just one of the required fields in the form and press the "Submit" button again to see a different message. Repeat as many times as you like with different combinations. Note all the different errors you can produce from this one, small file. Didn't you just see a bunch of these lines in the scripting code?
      • Note: What is so surprising about this file is that when you look at the content in a web browser you will see there are less than 50 words on screen. However, the web scripting embedded in the code (called "hardcoding") actually adds about another 150 words to this document that are not visible at first glance. This is called "dynamic" text...it requires action on the part of the user to display the content.
  9. IMPORTANT! Make a backup copy of form.htm from "...HTML/03_Trans"...place this anywhere you can find it later.
    • If you're curious: Now we have a backup of our translation in case we screw something up beyond repair.
  10. Begin translating the scripted messages in form.htm that you think are translatable. Use the Find 1 results list to locate the strings or just scroll up and down through the scripting looking for obviously translatable content. Use the following as a guide...

    TRANSLATABLE STRINGS IN SCRIPTING WILL...

    RULE EXAMPLE
    always be surrounded by quotes (most often double quotes, but sometimes single quotes) "translatable text";
    '
    maximum value'
    not be mixed case, nor have a lot of abbreviations "notXlatable";
    'maxValue'
    usually have spaces between the words
    (in phrases of two or more words or sentences)
    "a·line·for·translation.";
    maxValue + ' is·the·maximum.'
    not sound "unnatural" or ambiguous "notrans";
    'maxvalue'
    usually make sense when you read it out  
    • !!!WARNING!!! Make sure to ONLY translate the content between the quotes and follow the rules noted in the green box above. Remember, "When in doubt, leave it out!"... i.e. don't translate it unless you're positive it is translatable! Modify just one character in scripting that shouldn't be touched and it will break the code and the file will no longer work properly.
    • Save and test your file in the browser after every few changes to make sure nothing has broken (use steps in #8 above to test).
      • If at some point you notice the script is broken, undo your last few changes [Ctrl + Z], save the file and test again. Keep on undoing your changes a few at a time, save the file, then test until it is working again
      • If you just can't get the file to work again, close it and replace with the backup copy you created in step #9
  1. When you think you have finished the translation of all the scripting, test your file in the browser (again, refer to step #8)...make sure your messages are all fully translated and appearing correctly in the target language.
  2. Save form.htm when you think the scripting has all been translated

PART 3 - Other files for producing dynamic content (Custom) --- destination_settings.php

  1. Close form.htm
  2. Open destination_settings.php
  3. Ask yourself, "based on what I've learned about scripting thus far, is there anything translatable here?." Use what you've learned from PART 2 above including the rule: "When in doubt, leave it out!"
    • Do these seem to be a part of the site?
      • Note: What is so unique about this file is that when you look at the content locally in a browser (i.e., on your computer without a connection to the "live" site) it does NOT appear on screen. This content can only show when the site is running on a server (i.e., when it is "live")
    • Are there any hints we can use to trace back to where these might occur in the site?
      • Hint: How about the value that precedes the "=" sign? Try a little searching...
    • If you're not sure, look at the "live" site at compass.ritzdorfacademy.com. Do you see this text anywhere?
  4. Translate what you think is translatable
    • Note: This content can only be verified once the site is "live" so we will have to wait until the content is up on the web to see our results
    TRANSLATION MEMORY (TM) TOOL USERS!

    If you prepared your files in your preferred TM tool, you will not need to go searching for translatable content in HTML attributes (PART 1) since this is automatically found and extracted by most tools. However, the content noted in PART 2 & 3 here will NOT be identified correctly by traditional TM tools.

    • For form.htm either:
      • the scripted content will not be displayed at all OR
      • EVERYTHING between double quotes (including untranslatable content) will be displayed. This is very dangerous since it can easily result in a broken file.
    • For destination_settings.php nothing will be displayed. All tools will consider this an empty file.

    In our class, you will have to follow the instructions in PART 2 & 3 above to translate these two unique files. There ARE ways of getting this content into translation memory, such as manually marking up the file using tw4win (a.k.a. Trados RTF) markup and/or just copying the text into a Word or Excel file and then pasting it back into the original files once translation is completed.

    This is why really understanding what you are looking at for web content is so critical! Tools use simple computer-based rules to predict what is translatable and what is not, but they have no linguistic intelligence whatsoever. They will blindly tell you that "w@$u^" is translatable and that "Hello, my name is Hal" is not translatable if it is scripted content, so you need to use some common sense.