Run a script based on the current language

THESE PAGES ARE STILL UNDER CONSTRUCTION AND DO NOT NECESSARELY REFLECT THE CURRENT VERSION OF TÓPICO

In this tutorial, you'll learn how to run different part of a script based on the currently selected language. This feature could be useful in a setting where you want to copy the output folder (collection/online) to a different location based on the selected language.

Adding the language parameter to the script process

To send the current language as a parameter to a script, you need to add the %language% tag as the script parameter. See the image below.

Click the image for a larger view

Once this step is completed; you'll need to edit the script to for it to read this parameter.

Edit the script to used the language parameter

In the script below, after setting a default language on line 7 in case the script is called without one, the language parameter is read on line 11 and used on line 14 and 16. You can use as many language as you want with your collection.

VBScript
  1. Option Explicit
  2. 'script parameters
  3. dim args
  4. set args = wscript.arguments
  5. dim sLanguage
  6. sLanguage = "en" 'default language
  7. 'language is first argument
  8. if args.Count > 0 then
  9. sLanguage = args(0)
  10. end if
  11. if sLanguage = "en" then
  12. 'Do English stuff
  13. elseif sLanguage = "fr" then
  14. 'Do French stuff
  15. end if

THESE PAGES ARE STILL UNDER CONSTRUCTION AND DO NOT NECESSARELY REFLECT THE CURRENT VERSION OF TÓPICO

73 / 194