diff options
| author | Adam Soltys <[email protected]> | 2026-10-10 08:56:02 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-10 08:56:02 -0700 |
| commit | 3032399aeac4d055b97eeff122284def7733a650 (patch) | |
| tree | 600a7145fcba42b95b3207491cf5c9811ba16321 /tools | |
| parent | 336fd6da53ace71af2c949e35edd9f0aac664df7 (diff) | |
| download | coinosv3-3032399aeac4d055b97eeff122284def7733a650.tar.gz coinosv3-3032399aeac4d055b97eeff122284def7733a650.zip | |
Italiano. coinos speaks Italian: all 1,445 strings (the fullest of the locales — the others carry 923 or fewer and fall back to English), placeholders checked, informal "tu", wallet = portafoglio. An Italian phone now opens coinos in Italian, and posts translate into Italian because that's the app's language. The "phone language" translation fallback reads the app's own LANGS (no second list), and its test moved to a Dutch phone: tools/translate-phone-lang-test.js.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Vps2H27rhbG9ZqseGfMrc3
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/translate-phone-lang-test.js (renamed from tools/translate-italian-test.js) | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tools/translate-italian-test.js b/tools/translate-phone-lang-test.js index ab26e48..9e1eefc 100644 --- a/tools/translate-italian-test.js +++ b/tools/translate-phone-lang-test.js @@ -1,11 +1,11 @@ -// Translating into the phone's language: isolabellart's phone is Italian, -// coinos has no Italian UI (so it ran in English), and posts were never -// translated for them — the target was the app's language, and the guess -// didn't know Italian. Now an English post is translated into Italian on an -// Italian phone; an Italian one is left alone; Settings → Translation names +// Translating into the phone's language when coinos has no UI in it: +// isolabellart's phone was Italian before coinos spoke Italian, so it ran in +// English and posts were never translated for them. Here a Dutch phone (no +// Dutch UI): an English post is translated into Dutch (the stub answers in +// whatever words); a Dutch one is left alone; Settings → Translation names // the target and takes a DeepL key, which then rides with each request. // The registrar's /translate is stubbed (window.fetch shim). -// Run: bun tools/translate-italian-test.js +// Run: bun tools/translate-phone-lang-test.js import puppeteer from './puppeteer.js'; import { cacheKeyFor } from '../src/wallet.js'; import { generateSecretKey, getPublicKey, finalizeEvent } from 'nostr-tools/pure'; @@ -17,7 +17,7 @@ const AUTHOR = (() => { const sk = generateSecretKey(); return { sk, pk: getPubl const now = Math.floor(Date.now() / 1000); const post = (content, ago) => finalizeEvent({ kind: 1, created_at: now - ago, tags: [], content }, AUTHOR.sk); const EN = post('I think that the market is going to be very busy today and you should come with us', 100); -const IT = post('Penso che il mercato sarà molto affollato oggi e anche tu dovresti venire con noi per il caffè', 200); +const IT = post('Ik denk dat de markt vandaag heel druk is en dat je ook met ons mee moet komen voor de koffie', 200); const EN2 = post('This is another post in English that is not yet translated for you and the others', 300); const ANSWERS = { [EN.content]: { text: 'Penso che il mercato sarà molto affollato oggi e dovresti venire con noi', source: 'en' }, @@ -28,8 +28,8 @@ const server = Bun.serve({ port: 5317, fetch: () => new Response(html, { headers const browser = await puppeteer.launch({ executablePath: '/usr/bin/google-chrome', headless: 'new', args: ['--no-sandbox'] }); const page = await browser.newPage(); await page.evaluateOnNewDocument((answers) => { - Object.defineProperty(navigator, 'languages', { get: () => ['it-IT', 'it', 'en'] }); - Object.defineProperty(navigator, 'language', { get: () => 'it-IT' }); + Object.defineProperty(navigator, 'languages', { get: () => ['nl-NL', 'nl', 'en'] }); + Object.defineProperty(navigator, 'language', { get: () => 'nl-NL' }); window.__tr = []; try { delete self.Translator; } catch {} const real = window.fetch; @@ -72,17 +72,17 @@ try { await waitText('receive', 20000); await page.evaluate(() => document.querySelector('.app-nav-button[aria-label="Feed"]')?.click()); - console.log('\n[an Italian phone, coinos in English]'); - check('the English post is shown in Italian', await waitText('Penso che il mercato sarà molto affollato oggi e dovresti', 15000)); + console.log('\n[a Dutch phone, coinos in English]'); + check('the English post is shown translated', await waitText('Penso che il mercato sarà molto affollato oggi e dovresti', 15000)); const asked = await page.evaluate(() => window.__tr); - check('...asked of the registrar with target it', asked.some((b) => b.target === 'it' && b.text === EN.content), JSON.stringify(asked.map((b) => b.target))); - check('the Italian post is left alone', !asked.some((b) => b.text === IT.content)); + check('...asked of the registrar with target nl', asked.some((b) => b.target === 'nl' && b.text === EN.content), JSON.stringify(asked.map((b) => b.target))); + check('the Dutch post is left alone', !asked.some((b) => b.text === IT.content)); console.log('\n[Settings → Translation, with a DeepL key]'); await page.evaluate(() => { const b = [...document.querySelectorAll('button, a')].find((x) => x.getAttribute('aria-label') === 'Settings' || x.title === 'Settings'); b && b.click(); }); await sleep(800); await click('nostr'); await sleep(1000); - check('the card names Italian as the target', await page.evaluate(() => { const s = document.querySelector('.translate-to'); return !!s && s.value === 'it'; })); + check('the card names Dutch as the target', await page.evaluate(() => { const s = document.querySelector('.translate-to'); return !!s && s.value === 'nl'; })); await page.evaluate(() => document.querySelector('.deepl-key')?.scrollIntoView()); await page.type('.deepl-key', 'abcdef01-2345-6789-abcd-ef0123456789:fx'); await page.evaluate(() => document.querySelector('.deepl-save').click()); |
