hexagon logo

IF_GOTO/C1.INPUT and multiple languages...

OK, I'm stumped (not really, but I would like a general solution).

If I have an IF_GOTO/C1.INPUT == "YES" in my program, it will break when I change PC-DMIS to Swedish.

So, I can write IF_GOTO/(C1.INPUT == "YES") or (C1.INPUT == "JA") to make it work in English and Swedish (and some more, like German).

But how do I write to have it work in the current language PC-DMIS is set to, whatever language that is?

In the Report Editor there's a function LOADSTR(xyz) which can get the current translation of string #xyz, but that doesn't work in a part program.
Parents
  • $$ NO,
                Initialise B_RES (aka Boolean Result)
                ASSIGN/B_RES=0
    C1         =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Is NinjaBadger a genius?
    $$ NO,
                Get the comment type (i.e. YESNO) as a string
                ASSIGN/COMTYPE=GETTEXT(190,0,{C1})
    $$ NO,
                IF left part of that (as long as the number of charachters in the result) = the user selection, then it's a YES
                IF/LEFT(COMTYPE,LEN(C1.INPUT))==C1.INPUT
                ASSIGN/B_RES=1
                END_IF/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                B_RES



    I'm making the assumption it's always YESNO in that order, i.e. it's not NONOUI in French or something daft.

    Now we can have a boolean 1/0 result instead of a language specific!


    Edited as I realised I didn't need to use GETCOMMAND (YESNO command has an ID)
    Also I'd used "Comment Type" (language specific) as an argument for gettext instead of 190
Reply
  • $$ NO,
                Initialise B_RES (aka Boolean Result)
                ASSIGN/B_RES=0
    C1         =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Is NinjaBadger a genius?
    $$ NO,
                Get the comment type (i.e. YESNO) as a string
                ASSIGN/COMTYPE=GETTEXT(190,0,{C1})
    $$ NO,
                IF left part of that (as long as the number of charachters in the result) = the user selection, then it's a YES
                IF/LEFT(COMTYPE,LEN(C1.INPUT))==C1.INPUT
                ASSIGN/B_RES=1
                END_IF/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                B_RES



    I'm making the assumption it's always YESNO in that order, i.e. it's not NONOUI in French or something daft.

    Now we can have a boolean 1/0 result instead of a language specific!


    Edited as I realised I didn't need to use GETCOMMAND (YESNO command has an ID)
    Also I'd used "Comment Type" (language specific) as an argument for gettext instead of 190
Children
No Data