language tagging content versus setting course locale

maguire
Community Champion
1
236

Unfortunately, Canvas uses a course's course locale to both set the language of the HTML content and the language of the GUI. These are of course two different things - except in the case of a course actually teaching the user about a specific language - where it might make sense to have the language of the GUI the user is using in the course match the language of the course content -- while this is different that the user's preferred language for their GUI.

What is the solution to this problem:

  • Fix the code to have two different notions of the course locale: (1) the language of the course content and (2) the language of the GUI that the user is forced to use in this course.
  • Language tag the HTML content in the course.

Since the first of these solutions is unlikely to ever happen, the second solution can be done now! The problem is that few teachers are going to manually add language tags to all of the content that they put in a course. The solution to this problem is to enable the teacher to use a script to apply language tags to the course's content.

A program that can do this is language_tag_a_course.py 

The program can be found at https://github.com/gqmaguirejr/Canvas-tools

Doing so is as simple as language_tag_a_course.py 53524 sv  -- where 53524 is the course_id and sv is the language tag to apply. The program walks the course content and adds a language (lang) attribute to the HTML elements. Note that it does not alter any existing language attributes.

After language tagging the course's contents, the teacher should clear the course locale setting. Now Canvas will look at the user's choice of language to set the language of the Canvas GUI. Additionally, assistive technologies (such as screen readers) will now know which language to render the content in.

If you are a Canvas administrator, you can use another script list_accounts_and_courses.py that generates a spreadsheet containing information about all of the accounts you have access to and for each of these accounts generates sheets with information for each of the courses under this account. Now, if you look at the "locale" column, you can see which courses have a course locale set, and potentially, you can help the teachers of these courses by offering to add the language tags to their HTML and clear the course locale setting. The teacher does not have to know that this is a very easy thing to do for them 🙂

One warning: While you can run the language_tag_a_course.py script many times, you cannot undo its operation (without restoring the course contents) as it does not keep track of which tags have been added - so use caution.

There may be some courses for which a course locale still makes sense, but I expect them to not be very frequent (except for courses teaching a particular language — and even there, I'm not so sure that the user's choice of language for the GUI should be overridden).

1 Comment