mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-21 00:18:41 +00:00
* @hanzo/ui 8.30.0: every word the package authors is the reader's language
- The consumer installs every peer of the train it pins
- @hanzo/ui 8.30.0: every word the package authors is the reader's language
- i18n: one English fallback, the footer's doors through t, and a typed header cell
- agents: the elements i18n touched draw with gui props, not style
- i18n: @hanzo/ui/product/pure still depends on nothing
- i18n: the framework's collections, records and media say their words in the reader's language
- i18n: one English fallback for the pure modules that build a sentence
- i18n: the builder workspace says its words in the reader's language
- i18n: settings, the catalogue shelf and the backdrop presets
- i18n: the masthead's tree is marked for translation and drawn through t
- i18n: the product layer says its words in the reader's language
- i18n: mockups and market widgets say their words in the reader's language
- i18n: the gui controls say their words in the reader's language
- picker: each choosable option wears the field's own ink
- consent: the bar's fit width is a gui prop
- i18n: onboarding, chat, the model picker, sign-in, consent and the corner speak the reader's language
- i18n: @hanzo/ui peer-depends on @hanzo/i18n
* feat(i18n): localize built-in UI copy and the docs site
English stays the default. A locale on Hanzo or LocaleProvider switches
built-in labels, chat copy, and dates, and Arabic sets dir=rtl. Missing
keys render in English. The docs site adds a language switcher, prefixed
routes, hreflang, and a localized sitemap.
Co-authored-by: z <[email protected]>
* docs: translate every page into the 16 target locales
Each English doc now has a locale file under data/i18n. Code fences,
previews, links, and product names stay as written. A missing file still
falls back to English.
Co-authored-by: z <[email protected]>
* Unfinished: these files still contain <<<<<<< / ======= / >>>>>>> conflict markers on origin/agent/i18n-locales-0366: pk…
Run: sess_498ba60a49b5870a63d042e97f565728
* No conflict markers remain. Now: pull origin agent/i18n-locales-0366 (merge), run pnpm install --frozen-lockfile (if it…
Run: sess_0a7901763139b331895f48f02df95b94
* CI on agent/i18n-locales-0366 head 362214f fails @hanzo/ui tests 1-8, ui browser/vite/webpack. Concrete errors: (a) pkg/…
Run: sess_79bff23928c2986ee61768a243fc6dfa
* fix(ui): Dial RING from look; drop duplicate useI18n in Masthead
Unblocks pkg/ui build on #266: RING lives in ./look (not ./ring); Masthead had a duplicate const { t } = useI18n() after the #254/#287 merge.
* fix(ui): rtl.test ALLOWED counts for Masthead/DiffViewer/SlideOver
Align ALLOWED physical-side budgets with current source after the i18n merge: Masthead 2, DiffViewer 5, SlideOver 1.
* fix(ui): RepoSelect test expects default note + troubleshoot
Co-authored-by: Hanzo Dev <[email protected]>
---------
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: z <[email protected]>
Co-authored-by: hanzo-agent <[email protected]>
Co-authored-by: Hanzo Dev <[email protected]>
Co-authored-by: hanzo-platform[bot] <201622097+hanzo-platform[bot]@users.noreply.github.com>
78 lines
3.7 KiB
Python
78 lines
3.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Fix broken import blocks from the prefer-incoming resolution.
|
|
|
|
Pattern: an import line `import {` with body lines + `} from 'react'` got split
|
|
by the prefer-incoming choice: HEAD contributed the import header + some lines,
|
|
incoming contributed the closing `} from 'react'`. The repair re-merges:
|
|
find `import {` ... `from 'react'` fragments where the opening line is present
|
|
but the closing `} from 'react'` line is orphaned after other imports.
|
|
Simpler: for each broken file, restore its import header from main, then re-apply
|
|
useI18n import + remove useTranslate remnants.
|
|
"""
|
|
import pathlib, re, subprocess
|
|
|
|
broken = ['pkg/ui/src/agents/FileTree.tsx','pkg/ui/src/agents/Workspace.tsx',
|
|
'pkg/ui/src/backends/gui/command.tsx','pkg/ui/src/backends/gui/select.tsx',
|
|
'pkg/ui/src/chat/Plus.tsx','pkg/ui/src/product/ChipSelect.tsx']
|
|
|
|
for f in broken:
|
|
p = pathlib.Path('/work')/f
|
|
t = p.read_text()
|
|
main = subprocess.run(['git','show',f'main:{f}'],capture_output=True,text=True,cwd='/work').stdout
|
|
# extract main's import block (up to end of consecutive imports)
|
|
lines = main.splitlines(keepends=True)
|
|
hdrs=[]; i=0
|
|
# find first non-import after header comment region
|
|
for ln in lines:
|
|
if ln.strip().startswith('import '):
|
|
hdrs.append(ln)
|
|
elif hdrs and ln.strip()=='':
|
|
continue
|
|
elif hdrs and not ln.strip().startswith('//') and not ln.strip().startswith('*') and not ln.strip().startswith('/*'):
|
|
break
|
|
elif not hdrs and ln.strip().startswith('//') and False:
|
|
pass
|
|
# crude: take all import lines from main that use @hanzo/gui, react, lucide
|
|
imp_lines=[]
|
|
skip=False
|
|
for ln in lines:
|
|
if ln.strip().startswith('import ') or skip:
|
|
imp_lines.append(ln)
|
|
if "from '" in ln or 'from "' in ln:
|
|
skip=False
|
|
elif ln.strip().startswith('import '):
|
|
skip=True
|
|
elif 'import ' in ''.join(imp_lines) and not ln.strip().startswith('import '):
|
|
# if we have started collecting and hit non-import, and last was closed import, stop
|
|
if imp_lines and ("from '" in imp_lines[-1] or 'from "' in imp_lines[-1]):
|
|
break
|
|
continue
|
|
# remove old import region from work: from first import line to last line before first non-import def
|
|
wlines = t.splitlines(keepends=True)
|
|
# locate import region: contiguous lines starting with import or continuation (indented, type X, useState...)
|
|
# Simpler: remove every line matching ^import |^\s+type |^\s+use\w+,|^\s+} from
|
|
# but that would also remove code. Instead: use regex to replace broken fragments.
|
|
# Approach: delete lines from first 'import ' to the line 'import { useI18n' (inclusive of junk between),
|
|
# then insert main imports + useI18n.
|
|
start = next((i for i,l in enumerate(wlines) if l.startswith('import ')), None)
|
|
end = None
|
|
for i,l in enumerate(wlines):
|
|
if 'import { useI18n }' in l or 'import { phrase' in l or 'import { useI18n,' in l:
|
|
end = i
|
|
if start is None:
|
|
print(f, 'no imports'); continue
|
|
if end is None:
|
|
end = start
|
|
before = wlines[:start]
|
|
after = wlines[end+1:]
|
|
# also drop a stray blank line duplication
|
|
block = ''.join(imp_lines)
|
|
# ensure useI18n present if used
|
|
if 'useI18n()' in t and "@hanzo/i18n/react" not in block:
|
|
block += "import { useI18n } from '@hanzo/i18n/react'\n"
|
|
# strip any useTranslate from block
|
|
block = '\n'.join(l for l in block.splitlines() if 'useTranslate' not in l) + '\n'
|
|
new = ''.join(before) + block + ''.join(after)
|
|
p.write_text(new)
|
|
print(f, 'imports rebuilt:', block.count('import'))
|