aboutsummaryrefslogtreecommitdiffstats
path: root/src/lang-guess.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-10 08:39:24 -0700
committerAdam Soltys <[email protected]>2026-10-10 08:39:24 -0700
commit336fd6da53ace71af2c949e35edd9f0aac664df7 (patch)
treee2212759231fd6f02a397e1816bd1c5646d28614 /src/lang-guess.js
parent2338345063b0f1c816469401264b0cd0d7b7636b (diff)
downloadcoinosv3-336fd6da53ace71af2c949e35edd9f0aac664df7.tar.gz
coinosv3-336fd6da53ace71af2c949e35edd9f0aac664df7.zip
Translation: into the phone's language, and DeepL with your own key. isolabellart saw the Translate button but nothing became Italian: the target was the app's language, coinos has no Italian UI (so it ran in English), and the language guess didn't know Italian. Posts now translate into the reader's choice (Settings → Nostr → Translation, any of 31 languages), else the phone's language when the app has no UI for it, else the app's; the guess knows Italian, Dutch and Polish. And, as Jumble offers: a DeepL API key of your own, kept on the device and sent per request as x-deepl-key — the registrar passes it to DeepL (api-free for ":fx" keys; DeepL refuses browsers) and never stores or logs it; a refused key or used-up quota says so once. names: translateDeepl (prose only, links/tags kept, detected source back, 401/402/422 statuses), CORS allows the header. Deployed to cs names. tools/translate-italian-test.js, tools/deepl-translate.test.js.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vps2H27rhbG9ZqseGfMrc3
Diffstat (limited to 'src/lang-guess.js')
-rw-r--r--src/lang-guess.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lang-guess.js b/src/lang-guess.js
index 1d60c59..6d62e30 100644
--- a/src/lang-guess.js
+++ b/src/lang-guess.js
@@ -19,6 +19,8 @@ export const LANG_SCRIPT = {
en: 'latin', es: 'latin', fr: 'latin', de: 'latin', pt: 'latin', id: 'latin', sw: 'latin', tr: 'latin', vi: 'latin',
ru: 'cyrillic', ar: 'arabic', ur: 'arabic', hi: 'devanagari', mr: 'devanagari', bn: 'bengali', ta: 'tamil', te: 'telugu',
ja: 'kana', ko: 'hangul', zh: 'han',
+ // not app languages, but languages people read posts in (a translation target)
+ it: 'latin', nl: 'latin', pl: 'latin',
};
const STOP = {
en: 'the and is to of in that it for you with this on are be have not was but they'.split(' '),
@@ -30,6 +32,9 @@ const STOP = {
tr: 've bir bu için ile de da çok ne gibi daha ama var ben sen mi değil kadar her olan'.split(' '),
vi: 'và của là có không được một trong cho những này với các để người đã tôi khi cũng như'.split(' '),
sw: 'na ya wa kwa ni za la katika hii kuwa kama hata lakini sana yake wote sasa tu huo hapa'.split(' '),
+ it: 'il di che è e la un una per non sono con del della gli anche ma questo mi più nel'.split(' '),
+ nl: 'de het een en van is dat niet op te zijn met voor ik je die maar ook wat'.split(' '),
+ pl: 'i w nie na się z to że jest do co jak ale tak o po czy już'.split(' '),
};
const STOPSETS = Object.fromEntries(Object.entries(STOP).map(([k, v]) => [k, new Set(v)]));