Canada, Computer Science, STEM, Technology

What Language is Code?

What Language is Code?

Originally published in TEACH Magazine, 50th Anniversary of the Official Languages Act Special Issue, 2019

By Carolyn Gruske

As the demand for programming and coding instruction increases, teachers are faced with decisions about the best languages to teach: is it better to focus on languages that are becoming more popular like Python or Ruby, or are students better served by learning some traditional fundamentals like SQL or C++? There are, however other languages that Comtech teachers should consider including in their lessons: Canada’s two official languages, especially given this year marks the 50th Anniversary of the Official Languages Act.

That’s not to say students should be learning grammar rules during computer classes. What they should be exposed to is the idea that it’s important to program with multiple languages in mind.

In Canada, of course those languages are typically English and French, but in a world that is striving to create better user experiences and universal accessibility, that could mean producing software that works in dozens of different languages. In fact, creating multilingual software is just one small, but very important aspect of UX (or user experience) design.

“UX is the human side of creating the web,” says Carolyn Van, director of program design at Toronto-based Canada Learning Code, a charity devoted to teaching both educators and students, “particularly women, girls, people with disabilities, Indigenous youth, and newcomers,” how to program and to better understand technology. It offers teachers free lesson plans and brings lessons and computing labs to schools across Canada through its 14 Code Mobiles (vans carrying laptops that travel from school to school).

“Without UX, it’s just a bunch of lines of code, with the lack of consideration for the diverse needs that humans have. Your typical UX designer is very invested in understanding cultural nuances, different accessibility needs, different physical and cognitive abilities. Without UX our digital experiences are unusable, terrible experiences. A lack of good UX design will cause frustration, and will cause people to opt out of an experience,” she says.

Looking at purely physical accommodation, good UX practices mean creating apps and programs and software that work for everybody, including (but not limited to) those who have fine motor skills disorders or visual impairments or hearing impairments. Often, solutions to help users with these sorts of challenges involve language: voice commands to control computer functions or speech-to-text descriptions of photos or videos, or machine-generated transcriptions of audio files. It goes without saying that in order for these types of applications to be truly useful, they must be made available in the user’s language.

Along with being a good programming practice, and an approach that increases accessibility, there are times that developing a bilingual application or program is an absolute necessity.

“It’s not only important, in fact in the province of Quebec, it is the law,” says Diana Cheptene, IBM Studios leader for Montreal at IBM Canada Ltd. “It’s not even an option. It is required by law that we provide the users here in the province of Quebec English and French at the same time.”

To that end, Cheptene says that when IBM gives its introductory training sessions to newly hired employees, the company teaches them about best practices that support design principals from both a user interface and a software design perspective, and part of that involves emphasizing how important it is to develop applications accessible in multiple languages.

“We talk about the economy of being able to personalize an application to the individual. If we think about that trend, and the market, then giving the user an experience that feels personalized to them is a main driver on why this is important. And so is providing a positive user experience, and that means language, that means culturalization, that means regionalization as well,” says Cheptene.

Quebec isn’t the only province with rules in place about how content needs to be delivered. The Government of Canada, for example, publishes standards for how to build Application Programming Interfaces (APIs) if their developers wish to interface with government data. Those standards state the APIs should “support official languages” and give explicit instructions about what that means (such as using language codes and interpreting HTTP headers regarding language in a certain way). So graduated students who find themselves doing coding or application development work for government bodies will likely encounter programming that needs to accommodate both French and English speakers.

Even students who find themselves working for private businesses or public institutions will often discover their organizations use government data, so learning to deal with bilingual software is a useful skill. This is especially true if their organizations have the goal of reaching out to the largest number of users or customers.

This is also true for students who just want to make their own projects available to the widest possible audience.

“English content on the Internet is predominant, but that doesn’t mean we should all just be reading English. I mean there are lots of users who can’t, and they will not go to your site if they can’t speak the language,” says Christine McWebb, director of the Stratford School of Interaction Design and Business, that is part of the University of Waterloo. The school focuses on teaching students about digital arts and design within a global business framework.

While the need to present content in more than one language may not be readily apparent to everybody, McWebb explains that once the idea is presented to students and they are informed as to how this makes programs and applications and websites more inclusive, they tend to embrace the practice relatively easily.

Says McWebb: “I would say that the generation of students that we have in high schools and even in universities now is very, very attuned to this [need to be inclusive]. They are very aware of their own rights and obligations and responsibilities, and they are aware of the conversation around inclusivity, so this would not come as a surprise to them. And I think above and beyond just making them aware of the existence of other languages on the Internet, that perhaps they should think about this a little bit more if it will get them to think about the larger picture, which is accessibility and inclusivity not just limited to the use of language.”

Of course thinking about a concept is one thing, but applying lessons in a practical manner is a completely different learning experience. While students, especially those who aren’t in immersion programs may not have the language skills themselves to create both French and English content, Lennart Nacke, associate professor and director of the HCI (Human Computer Interaction) Games Group and Games Institute at the Stratford School says teachers can encourage collaboration between students who speak other languages so they get the experience of working not just with partners but co-operating on a bilingual or multilingual project.

He also suggests that teachers direct students who are interested in improving their skills on their own time to volunteer their services to assist with open source projects, especially smaller ones that are looking for people to work on regionalization or translation or documentation tasks. This, he says, is a wonderful learning opportunity, especially if the students are able to work with more experienced coders and developers.

(Open source software is software that is created and developed and maintained by groups of individuals who perform the work without compensation, and who make their programs available for free. The Firefox Web browser and the Thunderbird email program are two of the better-known open source programs. The website publishing and content management program WordPress is another. While these applications have millions of users, there are countless smaller, lesser-known open source software projects devoted to every type of interest imaginable.)

Gaining experience outside of the classroom is important, because Nacke says that when students hurry to finish assignments or get experience creating programs in hackathon environments (where teams compete to quickly create new applications) they end up adopting a “time equals money” mantra, where the rush to finish something is more important than considering things like inclusivity and multiple language capabilities. Then, if the students want to go back and review their work with an eye to improving those aspects of the application or program, they run into difficulties.

“If you’re in a start-up environment, or sometimes if you’re coming straight out of university and you haven’t really worked on larger things, you might just dive right in and hard-code things. And you end up with the sort of messy kind of code base where it gets really hard to translate stuff because you’ve hard-coded names or things like ‘join’ or ‘log in’ and you can’t easily switch to a different language,” says Nacke, (explaining that commands related to words should be coded as variables and the variables should point to a dictionary).

“But of course that’s highly important, because you’re building software while in a country like Canada and you need to make sure that the software is available in both languages. Knowing specifically that there are two language communities in the country, you want to make sure that even if you just have a website, it’s available in both of these languages.”

Beyond coding classes, mentioning that there is a need and a demand for translators to work in the tech industry might give other students—those with interests in languages or communications—a glimpse into their future professions or hobbies.

And while additional time and resources are needed to teach new concepts—especially ones that aren’t mandated in course curricula—one positive of teaching students about the need and the benefits of bilingual or multilingual friendly coding is, the lessons can be as simple or as complex as a teacher wants to make them. Simply saying, “Since Canada has two official languages, consider making your app available in both French and English so you can reach everybody in the country,” could be just enough to spark students’ interest in coding and in Canada’s official languages.

Tips for Creating Bilingual or Multilingual Programs

  • Remember that words and sentences aren’t the same length in different languages so ensure layouts (especially in menus or columns) make allowances for different word or letter counts.
  • Avoid using pictures of flags to indicate the languages available. Instead write out the name of the language, in the language so users can identify their own languages. This means use “English and français” not “English and French” or “anglais and français.”
  • Pick font sets that accommodate accents or characters that need to be rendered in all languages used.
  • Include information about the language presented on websites in the URL, so French pages would look something like “www.example.com/fr” while the English version would be “www.example.com/en.”
  • Adding what are known as hreflang tags to indicate the language of the page (or website) is also helpful to ensure that search engines see the language content of the websites correctly.
  • Make use of online machine translation services (like Google Translate) but always have a native speaker or fluent translator of the language review the output to ensure not just that it is accurate but that words, phrases, and idioms make sense in the target culture.
  • Don’t embed text in images. This way the same image can be used for every language version of the site. Also remember that text descriptions of the images should be translated into all the languages used on the website so that people using assistive technology can understand the description in their preferred languages.
  • Consider using icons instead of (or in addition to words) to help guide users through programs and applications, but ensure the icons convey the same meaning across all the languages of the site or application.
  • Refer to existing standards and guidelines such as i18n (for internationalization) and L10n (for localization) for best practices about how to render content (including things like time and money and numbers) in a way that respects various language and customs and cultures. Also, look for internationalization and language guidelines for specific interfaces if you are creating programs to run on specific devices (for example, Android, iOS, etc.)

Carolyn Gruske is an award-winning reporter and former magazine editor. She often writes about the intersection of business, technology and the law, but she also has a deep interest in educational topics.