fix(assistant): answer Brazilian Portuguese users in Portuguese, not Breton

TREK's code for Brazilian Portuguese is 'br', which Intl reads as Breton.
The assistant passed it straight to Intl.DisplayNames for the system
prompt's answer language and to the card formatters, so the model was told
to answer in Breton. Convert TREK codes to their BCP-47 tag with
getIntlLanguage before handing them to Intl.

Closes #2800
This commit is contained in:
Allan Braun
2026-10-25 17:14:16 -03:00
committed by Maurice
parent d07c17ded6
commit 69ff295184
5 changed files with 20 additions and 2 deletions
@@ -231,6 +231,12 @@ describe('the turn context', () => {
expect(languageName('!!')).toBe('!!');
});
it('ASTCTX-033: reads TREK language codes as their language, not as the BCP 47 tag they spell', () => {
expect(languageName('br')).toBe('Brazilian Portuguese');
expect(languageName('gr')).toBe('Greek');
expect(languageName('pt-BR')).toBe('Brazilian Portuguese');
});
it('ASTCTX-022: carries the date, the units the user prefers and the card', () => {
const card = buildTripCard(1, 7, SUMMARY, PLACES, null);
const context = turnContext(card, 'Asia/Tokyo', new Date('2026-06-11T23:30:00Z'), {
@@ -69,6 +69,7 @@ describe('dayLabel', () => {
expect(dayLabel(ctx, 99)).toBe('#99');
expect(dayLabel({ ...ctx, locale: 'de' }, 32)).toBe('Fr., 12. Juni');
expect(dayLabel({ ...ctx, locale: 'not a locale!' }, 32)).toBe('Fri, Jun 12');
expect(dayLabel({ ...ctx, locale: 'br' }, 32)).toBe(dayLabel({ ...ctx, locale: 'pt-BR' }, 32));
});
});