[LON-CAPA-users] Access to effective language in scriptblock?

Guy Albertelli II lon-capa-users@mail.lon-capa.org
Tue, 19 Jun 2007 13:04:22 -0400 (EDT)

Hi Stefan,

> Imagine that you'd like to create a problem which should be offered in
> two or more different languages. The effective language which will be
> used for the student depends on the different settings within LON-CAPA,
> e.g. user's language preference or course setting.
> For problem texts in different languages, the languageblock could be used:
> <problem>
> <startouttext />
> <languageblock include="de">Deutscher Text</languageblock>
> <languageblock exclude="de">English text</languageblock>
> <endouttext />
> [...]
> </problem>
> But what to do if the text elements must be "calculated" in the script
> block? Is there any possibility to access the effective language within
> the script block?

looks one can do this right now:

 <languageblock include=\"de\">$german_text</languageblock>
 <languageblock exclude=\"de\">$english_text</languageblock>

Wouldn't be difficult to add a &get_preferred_languages() routine to
return the list of desired languages.

> For example, this is necessary for the option list and
> the answer for optionresponse and for the answer for stringresponse, etc.
> I can send example code if needed. There are quite a lot of different
> problems where this is needed.
> Thanks for any help,
> Stefan Bisitz

guy@albertelli.com   0-7-0-9-27,137