Building a bilingual AI chatbot for Canadian users: English, French and the privacy checks in the code
A chatbot that works well for a shop in Dallas can still go wrong in Toronto, Montreal or Ottawa. Canadian users expect French as a first-class language (and in Quebec the law expects it), and the privacy rules that appl
A chatbot that works well for a shop in Dallas can still go wrong in Toronto, Montreal or Ottawa. Canadian users expect French as a first-class language (and in Quebec the law expects it), and the privacy rules that apply to the data flowing through the chat window are different from the US ones.
This post is the checklist we work through when we build an AI chatbot for a Canadian business. It is written for developers, not lawyers, so treat the legal notes as pointers to read, not advice.
1. Decide where the language comes from
You have three signals, in order of reliability:
- An explicit choice. A visible EN | FR toggle in the chat header. Always offer it, and remember it (a cookie or local storage key is fine).
-
The page language. If the chat is embedded on
/fr/pages, start in French. Readdocument.documentElement.langwhen the widget loads. -
The browser.
navigator.languagesgives you the user's preferred list. Use it only as a hint for the first greeting.
function initialLocale() {
const saved = localStorage.getItem('chat_locale');
if (saved) return saved;
const pageLang = (document.documentElement.lang || '').slice(0, 2);
if (pageLang === 'fr' || pageLang === 'en') return pageLang;
const pref = (navigator.languages || ['en'])[0].slice(0, 2);
return pref === 'fr' ? 'fr' : 'en';
}
Then pass the locale to the model on every turn, in the system prompt, rather than hoping it copies the user's language. If a user switches language mid-conversation, follow them and update the stored value.
2. Keep two knowledge bases, not one translated on the fly
If the bot answers from your own content (retrieval-augmented generation), index the English and French versions of each page separately and tag each chunk with its language. Retrieve in the user's language first and fall back to the other language only when nothing relevant comes back.
Translating English chunks into French at answer time looks cheaper, but it produces inconsistent terms (product names, legal wording, prices written with the wrong decimal separator) and it makes it hard to show the source link in the right language.
A practical schema for each chunk:
{
"id": "returns-policy#2",
"lang": "fr",
"url": "https://example.ca/fr/retours/",
"title": "Politique de retour",
"text": "...",
"updated": "2026-10-01"
}
3. Format money, dates and phone numbers per locale
Use Intl instead of string templates:
new Intl.NumberFormat('fr-CA', { style: 'currency', currency: 'CAD' }).format(1499.5);
// "1 499,50 $"
new Intl.NumberFormat('en-CA', { style: 'currency', currency: 'CAD' }).format(1499.5);
// "$1,499.50"
Do the same for dates. Ask the model to return structured data (amount, date) and format it in your code, so a hallucinated format never reaches the user.
4. The privacy checks that change the code
PIPEDA applies to private-sector organisations that collect personal information in the course of commercial activity in most of Canada. Alberta, British Columbia and Quebec have their own private-sector laws for activity inside those provinces. In practice the same engineering controls cover all of them:
- Tell people what happens to the chat. A one-line notice under the input box ("Chats are stored for 30 days to improve answers. Privacy policy") plus a link.
- Collect less. Do not ask for a date of birth or a full address in chat unless the task needs it. Mask card numbers and health card numbers with a regex before anything is logged or sent to a model provider.
- Know where the data goes. List your model provider, vector database and logging tool, and the region each one stores data in. Your client will be asked.
- Retention. Put a TTL on chat logs and actually delete them.
Quebec's Law 25 adds two things developers notice:
- If a decision about a person is made exclusively by automated processing, the person has to be informed. A bot that only answers questions is not making decisions, but one that approves refunds or pre-qualifies leads may be. Route those to a human or disclose it.
- Before personal information is communicated outside Quebec (for example to a US model API), the organisation has to assess the privacy impact. Your client's privacy lead will want the data-flow list from the previous section.
The Office of the Privacy Commissioner of Canada has also published principles for generative AI (December 2023) that are worth a read before you write the system prompt. The federal AI bill (AIDA, part of Bill C-27) did not become law: it died when Parliament was prorogued in January 2025.
5. French is not a feature flag in Quebec
Quebec's Charter of the French Language, as amended by Bill 96, requires businesses to serve and inform consumers in French. For a chatbot this means French must be available, of equal quality, and not hidden behind an English-only first message. Test both languages with the same test set:
| Test | EN | FR |
|---|---|---|
| Opening hours, holidays | ✅ | ✅ |
| Refund policy question | ✅ | ✅ |
| Handoff to a person | ✅ | ✅ |
| Prices and taxes (GST/HST/QST) formatted correctly | ✅ | ✅ |
6. Handoff and logging
Every Canadian business we work with asks the same question: what happens when the bot can't answer? Give it a tool that creates a ticket or sends the transcript to a shared inbox, in the user's language, and say so in the reply ("Je transmets votre question à notre équipe…").
Log, for each conversation: locale, retrieved chunk IDs, whether a handoff happened, and the model version. That is enough to debug most bad answers without storing more personal data than you need.
FAQ
Do I need a separate model for French? No. Current general models handle Canadian French well. What matters is French source content and a French test set.
Can I host the chatbot data in Canada? Many cloud providers offer Canadian regions for databases and logs. Model APIs vary, so check the provider's data-residency options and write down where data goes.
Is a chatbot disclosure required? Telling users they are talking to an automated assistant is good practice and expected under the OPC principles. Put it in the first message.
If you are scoping a chatbot like this for a Toronto, Ottawa or Montreal business, this is the work our team does on AI chatbot development in Canada, from bilingual content indexing to the handoff into your CRM.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.