Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

HTML5 canvas and multilanguage with i18next

New Here ,
Dec 13, 2021 Dec 13, 2021

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

207
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2021 Dec 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 13, 2021 Dec 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 !

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2021 Dec 13, 2021
LATEST

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

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines