Skip to main content
Participant
December 13, 2021
Question

HTML5 canvas and multilanguage with i18next

  • December 13, 2021
  • 1 reply
  • 231 views

Hi everybody

I would like to know if it's possible to dynamically change the text in a canvas in javascript. I need to create a multilanguage animation with a language switcher.

I know how to to this with static code and i18next but I cant find how to do it with canvas.

 

Thanks

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    December 13, 2021

    use a dynamic textfield

    assign it an instance name (eg, tf)

     

    if you're coding on the timeline that contains tf, use:

     

    this.tf.text = "english";

     

    to assign text.

    Participant
    December 13, 2021

    Thanks @kglad

    I use a dynamic textfield with an instance name. Can you explain me what do you mean by "coding on the timeline" ? Coding in the js file generate by animate ? I'm pretty new with animate, a whole world to discover !

    kglad
    Community Expert
    Community Expert
    December 13, 2021

    you can add your own code to do things like assign text to textfield.  if the textfield were in a movieclip (eg, with instance name mc on the main timeline), you would use:

     

    this.tf.text = "eng";  // on mc's timeline

     

    and

     

    this.mc.tf.text = "eng"; // on the main timeline