Switching Languages during the interview

Please login to reply  Page: « < 1 of 1 > »
25 Jun 2010 - 13:30649
Switching Languages during the interview

I'm adding a second language (Spanish) to my survey.

So far, I've added...

LANGUAGES =
  ENG "English",
  ESP "Español" 

to my .bla file.

This particular survey is a household survey, so the first question for each individual in the household allows the interviewer to select the language to be used for this particular individual ...

FIELDS

    BEGIN_Individual "@B ^IndFirstName @B
                      @/
                      @/@|@S Interviewer:
                      @/
                      @/@| What is your language preference for this individual? @S" : TLanguage 

...

RULES
    BEGIN_Individual
    IF BEGIN_Individual = ENG THEN SETLANGUAGE(ENG) ENDIF
    IF BEGIN_Individual = ESP THEN SETLANGUAGE(ESP) ENDIF

...

This seems to be working fine, but ....

Let's say that the interviewer decides after several questions that the other language would be better suited for this individual. Instead of going back several questions and changing the response to the first question, he decides to switch languages by menu (Options, Form Language, etc.). This also seems fine, at least for the first question, but the language then reverts back to the original language for the following questions.

For example, the interviewer starts out with English, then after several questions he decides that Spanish would work better. Rather than going back to the beginning, he switches languages via the menu, and the next question is in Spanish. But, then the next question (and the next question...) is back in English.

My hunch is that my SETLANGUAGE code and the menu switching is in conflict somehow, but I'm not sure how.

How can I get the language switch by menu to "stick?"



27 Jun 2010 - 15:17653
Reset the trigger question

Hi Bill

The problem is that the rules are executed each time another question is asked. Therefore the language will be reset to the value of the trigger question, even when changed by the menu. What you need to do is NOT use the TLanguage type but define your own Type and make sure that it has a third setting ( eg. NA for 'As already defined' ). Then after the trigger question is asked and you have acted on the answer, reset the answer for the trigger question to NA. In that case all future application of the rules will not change the language.

I have prepared a sample datamodel with this in it:

DATAMODEL TestLanguage
LANGUAGES =
  ENG "English",
  ESP "Español" 
TYPE
  TLangs = (ENG "English" 
           ,ESP "Español"
           ,NA  "As already defined"
           )
    
FIELDS
  IndFirstName "What is your name" / "Name" : STRING[20]
  BEGIN_Individual "@B ^IndFirstName @B
                    @/
                    @/@|@S Interviewer:
                    @/
                    @/@| What is your language preference for this individual? @S" : TLangs
  Next  "This is the next question in English"
     ESP "Spanish version of next question"
     : STRING[2]
  Another "This is another question in English"
     ESP "Spanish version of another question"
     : STRING[2]
    
RULES
  IndFirstName 
  Begin_Individual
  IF BEGIN_Individual = ENG THEN
    SETLANGUAGE(ENG)
    {Now reset the trigger question to NA}
    Begin_Individual:=NA 
  ELSEIF BEGIN_Individual = ESP THEN
    SETLANGUAGE(ESP)
    {Now reset the trigger question to NA}
    Begin_Individual:=NA 
  ENDIF
  Next
  Another
ENDMODEL 

Cheers

Fred



28 Jun 2010 - 12:36658
Thanks again, Fred.

Your technique is similar to what I've used in other programming languages.

I guess I figured that since TLANGUAGE & language switching via menu were both built-in to Blaise, they would play nice together.

My bad.



28 Jun 2010 - 17:40660
Oops

This was working fine, until the survey got to the inevitable next block ... then it seems all bets are off again ... the survey actually "locks up" when I try to switch languages via the menu. <sigh>

I suppose I could pass another parameter, but this survey has manymanymany blocks and I'd hate to have to add code for passing & accepting parameters to all those blocks.

Any ideas for a quick & dirty solution to this one?



02 Jul 2010 - 02:51676
What parameter

Hi Bill

I am not sure why your instrument should 'lock up'. What parameter were you thinking you would need? One containing the current language? What for?

If you want to know what language is turned on then use the ACTIVELANGUAGE function. That way you should be able to detect the language change that was made through the preliminary question or the Menu at any time.

Fred



02 Jul 2010 - 12:52679
Hi Fred

Hi Fred,

I've been working on some Manipula stuff the last couple of days, so I went back and tried my survey again.

First, I gather some household roster info. Then I start doing "individual' questionnaires. After the individual questionnaire each subject takes a questionnaire designed to diagnose the likeihood of developing diabetes.

The individual questionnaire and the diabetes questionnaire are in their own blocks. At the very beginning of the individual questionnaire is where I ask for the language preference. Using your "reset the trigger question" code in this block I can now switch languages back & forth with no issues as long as I'm still in this block.

Once the individual block is completed and the diabetes block begins, I can no longer rely on language switching via the menu. If I try, the survey locks up. I thought maybe passing a parameter with the language preference to the diabetes block may help to avoid the survey freezing up, but other stuff has prevented me from trying it yet.

It's Friday morning in Chicago, and I have some more Manipula coding to get done prior to a client meeting later today. Next Monday the office is closed to observe the 4th of July holiday.

Next Tuesday I'll try and extract out just the necessary code to recreate the problem (the entire survey has grown too large to post here). It's probably just something silly I'm overlooking.

"See" you next week.



02 Jul 2010 - 17:44680

Hi Bill

If you like you can send me the instrument. You should have my email by address by now.

Fred



02 Jul 2010 - 18:17681
The zip file is on it's way.

Thanks!



Please login to reply  Page: « < 1 of 1 > »