0

I am using react and meteor for web development. I want to able to change font family respect to language change. I am using i18n to translate to different language. For english I want 'Century Gothelic' and for thai text I want to change it to Sukhumvit font. How I can achieve this.

Mritunjay Upadhyay
  • 1,004
  • 1
  • 15
  • 27
  • 1
    How do you check for language? Is there an option in the UI or do you check it based on location? [This](https://stackoverflow.com/a/8199791/2363481) might help to detect it. Then you could maybe set a `className` to the body depending on the detection and set the `font-family` that way. – Daan Apr 23 '19 at 06:50
  • @Daan there is buttton in ui to change to thai. I am not changing everything to thai just some big text(or info). So I dont think changing font-family at body level is good idea as there may be many text which are in english. And these english text look ugly in thai font. – Mritunjay Upadhyay Apr 23 '19 at 07:04

1 Answers1

1

You might try to use a global css class and relatively change font-family based on language.

On how you can achieve that, if you're using redux, it's pretty easy, every time you change language (click button or something), dispatch an action to change the state that related to the global css class.

Otherwise, you have to figure out how to store that language change to express it so that main app component can detect that change.

Pho Huynh
  • 1,497
  • 3
  • 13
  • 23