How to change specific custom font when user switch a language?

Sepiroth X Posted in Theme Development 3 years ago

Hello Devs! Salute to all of you and for your hardwork!

I just want to ask a question, is it possible to change a language into a custom font whenever a user change his/her language preference under his/her account settings? For example, default language of user is english right? On my website the font-family is PT Sans, etc.

What if the user decides to change to another language on his/her account settings into TAGALOG for example? I want to use a custom font for it if a user decides to choose Tagalog in the language setting. Is it possible?

Yes the language will be changed but is there a way to change the font-family as well once the user change to a specific language?

Reason of question and aims to achieve:
- Honestly, I'm working on a social network wherein Filipinos can use the ancient writing system called 'baybayin' without installing any baybayin keyboard.

What I did so far is that, --my friend has custom fonts which I converted into web fonts and installed them to my website. I achieved what I want, which is to translate all latin letters (alphabets) into baybayin characters and everyone who would like to input any letters on the website will see the baybayin characters from the webfont of my friend's font.

So what I want to achieve this time is to let users decide either they want to use the english (no web font) or the baybayin one (with webfont). That's why I asked the question.

Here is my development website for you to check and have I idea on what I mean. I hope someone can give me an Idea or tip how to achieve this.

https://development.tayona.ml .

Thank you!

Replies
ph Sepiroth X Replied 3 years ago

@~Z~ Man, I already updated it Sir, pls check if there's something I left untouched. Thanks!

German Michael Z├╝lsdorff Replied 3 years ago

Sri Visjaya Yogi,
this is to remind you on the note I left 2 days ago on your theme page.

ph Sepiroth X Replied 3 years ago

Hello Sir Arsalan, thanks for your reply. I will give it a try when I'm home.

Just wanna ask, language == 'abc' ,

abc means 'tl' for tagalog?

Indonesian Arsalan Shah Replied 3 years ago

You need to exten ossn/site/head or edit your theme page.php file that checks

<?php if($user->language == 'abc'){ ?>
       <style> body { font-family: abc; } </style>
<?php } ?>

that's it