Totara Learn Open Discussions

Localisation and fonts coding

 
Simon Coggins
Re: Localisation and fonts coding
par Simon Coggins, Thursday 14 November 2019, 10:53
Groupe 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