I'm trying to develop a PDF in two languages. When pushing a button, all questions and list-of-values for possible answers should be translated.
I created and initialized several variables with the two language phrases with javascript. Everything is inside my code.
Is there anyway that when a button is pressed an external file is read, bringing that javascript code for questions ans list-of-values? My concern is that currently I have a duplicated code, but if I want to implement three, four languages it will grow without control.
This is an example I wrote in my code:
var TxtAuxL1ESP = new Array();
var TxtAuxL1ING = new Array();
TxtAuxL1ESP[0]=", como ";
TxtAuxL1ING[0]=", such as ";
TxtAuxL1ESP[1]=": el último año ha obtenido ";
TxtAuxL1ING[1]=": last year it obtained ";
TxtAuxL1ESP[2]="%, en los últimos tres años ";
TxtAuxL1ING[2]="%, in the last three years ";
TxtAuxL1ESP[3]="% y en los últimos cinco años ";
TxtAuxL1ING[3]="% and in the last five years ";
//...
if (P1.BtnIdioma.border.edge.stroke == "raised") {
var TxtAuxL1=TxtAuxL1ESP;
var TxtAuxL2=TxtAuxL2ESP;
var TxtAuxL3=TxtAuxL3ESP;
}
else {
var TxtAuxL1=TxtAuxL1ING;
var TxtAuxL2=TxtAuxL2ING;
var TxtAuxL3=TxtAuxL3ING;
}
What I was thinking is to store TxtAuxL1ING in one file, TxtAuxL1ESP in another file and read them from my javascript code inside the PDF. Is it possible?
Regards
JC