Totara Learn Open Discussions

Localisation and fonts coding

 
Gosia Dynska
Localisation and fonts coding
by Gosia Dynska - Wednesday, 13 November 2019, 8:54 AM
 

Hi All!

I am implementing a translation of a quiz built in Totara. The translation is into 8 languages that are rather not common. I stumbled across a font related issue.

We exported the English version to XML and translated it, then we imported it back to the LMS. All the languages work fine except Myanma bhasa and Karen. I get some randoms signs instead of what I can clearly see in the word document. I tried simply to copy-paste the text directly on the LMS but it doesn´t change anything. I am very surprised on the other hand to be able to paste some of the text here!


ရုပ်ပုံနှင့် အညွှန်းစာသား တွဲပါ။ (Can you see it ?:))


Why I can´t do that on my Totara? How I can solve this issue?

Simon Coggins
Re: Localisation and fonts coding
by Simon Coggins - Thursday, 14 November 2019, 10:53 AM
Group Totara

There's a number of technical complexities going on here but I'll try and explain without that detail, unfortunately some terminology is necessary.

To correctly render a character outside of the standard range you need two things:

1. The underlying system needs to support a system called 'unicode'

2. The font that is displaying them needs to include the characters (so the font knows how to draw the characters)

Totara is fully unicode compatible, meaning 1 should not be the problem. You should get your system administrator to check the 'character encoding' of the database to make sure it's using 'utf8' to ensure characters can be stored in the right format.

Most likely you are seeing an issue with 2 - the font being used by your theme doesn't support the characters you are trying to display. Different fonts will typically only implement a subset of all possible characters, and in many cases your average font won't support characters required for a less common language (such as one based on glyphs).

So the answer is to change the font in your theme to use a font that supports the range of characters you intend to use. You should be able to search for fonts that support specific languages, e.g. something like:

https://www.fontsquirrel.com/fonts/list/language

However there is another approach, which we use on this site and in more recent versions of Totara, which is to set the site to use fonts that are pre-installed on the operating system. Typically these system fonts have very good language support and so will work for pretty much everything. To do that you would use a font declaration like the one below in your theme's CSS:

font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif

This (technical) article explains why this is a good approach and how it works:

https://bitsofco.de/the-new-system-font-stack/

Good luck,

Simon