Multilingual support for text labels within a web export

christian.mercat shared this question 8 years ago
Answered

Hi there,


So, we are exporting geogebra applets and would like to set up the text labels from within the web export from a javascript parameter based on the language chosen/set by the user. The easiest way would be to load a properties file containing all the text names and their values, as an xml file or whatever and have whether the document or directly geogebra to deal with it.


From the javascript side, it would be a loop on the items and a

    document.ggbApplet.evalCommand("key=value");

Is there a way on the geogebra side? I don't think so as far as I know...


Thanks, Ch.M.

Comments (4)

photo
1

We were pondering: is it possible for a ggb applet to load in a ggt file? We could have a ggt file setting all the text labels for all different languages, for example

    Switch["fr"]

would load the French text version. What do you think? Is it feasible? Thanks, Ch.M.

photo
1

The most robust way would be to change GeoGebra's XML server-side, zip it and base64-encode it there.


Alternatively you could use ggbApplet.setXML() in the browser.

photo
1

Dear Murkle,


Thanks for the answer, but I don't get it, what should I put in the xml file and where should I put it? Sorry to be so lame but I don't see what to do with it.


Thanks, Christian

photo
1

Hi, I don't answer but I give you, maybe, an easy idea to do a little step toward what you want. A script like :

    g=ggbApplet;

    n=g.getObjectNumber();

    b=1;t=1;c=1;

    for (k=0;k<n;k++)

    {name=g.getObjectName(k);

    if (g.getObjectType(name)=="button")

    {g.renameObject(name,"bouton"+b);b=b+1;};

    if (g.getObjectType(name)=="text")

    {g.renameObject(name,"texte"+t);t=t+1;};

    if (g.getObjectType(name)=="textfield"){

    g.renameObject(name,"ChampTexte"+c);c=c+1;};

    }

(i've not writen all the types, it"s just an idea)

Try it on GeoGebraTube.

Michel

© 2021 International GeoGebra Institute