Files
hanzo.ai/e2e/unit/language.spec.ts
zeekay db82b38d02 Corner: Help and Preferences in the bottom corner of every site page
@hanzo/ui's Corner, mounted once (components/shell/help.tsx): Get help
(/support), Docs (docs.hanzo.ai, a new tab) and Contact us (/contact),
then Theme and Language. It sits at the start corner, so Arabic puts it
bottom-right. No Currency row: hanzo.ai bills in US dollars only.

Language is lib/language.ts, now in Corner's shape: @hanzo/i18n's
registry less the locales waiting for review, each in its own script
with its English name to search by, and the i18n setter, which sets
<html lang dir>.

Not drawn in the app: the rooms and the app at /, /dev and /studio keep
the account at the rail's foot, bottom-left, and their Settings holds
the preferences there. /dashboard joins the rooms' table. Not drawn
while the cookie banner asks, so the two never share the foot. /start's
composer band now clears the start side on a phone, where it cleared
the end for the help mark removed earlier, and the corner mounts after
the page so it paints over that band.

Gate: e2e/gates/help.spec.ts.
2026-10-22 13:05:18 -07:00

31 lines
1.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { test, expect } from '@playwright/test'
import { locales } from '@hanzo/i18n'
import { offered } from '../../lib/language'
/**
* THE CORNER OFFERS WHAT THE PICKER OFFERS.
*
* `offered` is what hanzo.ai hands the corner control; Settings → General draws
* @hanzo/i18n's own `LanguagePicker`. Both follow one rule: every locale but
* those waiting for a native reader, and the reader's own language whatever it
* is. Held against the registry, so a locale cleared from review appears in
* both at once.
*/
const waiting = locales.filter((l) => l.review).map((l) => l.code)
test('every language a native reader has cleared, named in its own script, its English name to search by, with its direction', () => {
const list = offered('en-US')
expect(list.map((l) => l.code)).toEqual(locales.filter((l) => !l.review).map((l) => l.code))
expect(list.find((l) => l.code === 'ar')).toEqual({ code: 'ar', label: 'العربية', hint: 'Arabic', dir: 'rtl' })
expect(list.find((l) => l.code === 'en-US')?.dir).toBe('ltr')
})
test('a language waiting for review is not offered, unless it is the reader’s own', () => {
expect(waiting.length, 'the registry marks some as waiting').toBeGreaterThan(0)
for (const code of waiting) {
expect(offered('en-US').map((l) => l.code)).not.toContain(code)
expect(offered(code).map((l) => l.code)).toContain(code)
}
})