Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Setup Anim
Killing Moon / Director
mySystem
Export JPEG
Volume Slider
Anim-FX Flash intros & Flash banners builder
DM Transitions Pack 2
Library for the control of volume in Director
Director 8.5 Shockwave Studio: The Complete Reference
Set ImageEnabled Property of a Flash Member
 

 

 

Article Multiple languages in the same movie.

Added on 9/13/1999

 

Compatibilities:
D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: MediaMacros (website)

I have a Director project that will eventually run in 8 different languages. Is there an easy way to handle this or do I need to make 8 separate movies?

Get the source
Multi-lingual movies are something Director handles very well.  Many people approach this problem thinking that they will need a new Director movie for each language they build.  The other approach people consider is to put redundant versions of everything in their internal cast and just have lingo load the correct graphics.   This can work, but your files are loading far more data than they ever need to use, and it will unnecessarily slow you down.  So what is the easiest way to do this?   Well, as most Director users realize, Director can link to external files.   This is handy when working on a project and you want to swap out the graphics.   Just write over them and Director uses the new version.  The same thing can be applied to cast libraries as well, and Director can even swap them out on the fly.   For the sake of simplicity, lets take a few images to do our little test.

Lets make a simple movie with one image and a set of 5 buttons.  The image will be of a flag and each button will distinguish a country/language.  The buttons and scripts all go in the internal cast, but we place the graphic in an external cast named "language."  One nice thing about Director's casts is that the cast library name does not need to be the same as the file that it uses.  We save this external library as "english.cst."  Now here comes the trick.  We copy this cast and rename each copy to a different language.  (French, German, Japanese, and Spanish)  We then open each library and swap the graphic for one more suited to the current language.  Make sure to keep the names and location the same as this is how lingo and Director can be referencing the members, but as far as the project knows it will still be using the same graphic.  Now we open up the original movie that is still linked to the "english.cst" file.  In it we place this script...

--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know. :-)

on setLanguage
  global gLanguage

  if gLanguage = void then gLanguage = "english"
  currentFilename = castlib("language").filename
  if the platform contains "Win" then
    theD = "\"
  else
    theD = ":"
  end if
  the itemDelimiter = theD
  thePath = currentFilename.item[1..(currentFilename.item.count - 1)]
  castlib("Language").filename = thePath & theD & gLanguage
  updateStage
end

on getBehaviorDescription me
  return "This script swaps out the castlib named language for another external library in the same directory that is named the same as the language it uses. For example, the file used by the language library might be named spanish.cst. When changing the global gLanguage to french then running the script, the language cast is swapped for the french.cst file."
end

Now all we need to do is have the buttons change the value for the global variable "gLanguage" and have them run this handler.  The handler checks the current location of the castlib and looks for a cast with the name of the language.   It then opens that library and everything in the score is referencing the new cast.   This is pretty simple for one image, but imagine the time it saves with a project that has hundreds of assets.  Sounds, text items, graphics and more can all be swapped with ease by just changing out the cast library.  Give it a try and you will quickly see how this one little property of a cast library can be very powerful.

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail