601451f22b
Overlay ~150 upstream items onto our V8.12 base, preserving trade-pro
theme, registry tests, and design docs. Re-applied our patch set
(discovery/env_for/blocks.css/type-mapping/theme_color/frontend entries,
test_theme_pro_v3 mods) — all anchors survived upstream evolution.
New platform enhancement (fixes upgrade-introduced regression):
multilingual.site_locale now honors settings_json.locale, plus
PUT /api/i18n/sites/{id}/locale — standalone English sites get
<html lang='en'> under the V8.15 locale-rewrite pipeline.
compose: adopt V8.21.3 (image 8.21.3-dev.1, /api/ready probes, MySQL/S3
env) with project name pinned to siteforge-v8-10 (data volumes).
Tests: 356 passed / 11 failed — all 11 confirmed pre-existing in
pristine V8.21.3 on this host (10 upstream Windows env + our build test
now green after locale fix). Patch registry updated in plan doc.
Co-Authored-By: Claude Code <noreply@anthropic.com>
33 lines
2.0 KiB
Python
33 lines
2.0 KiB
Python
"""Deterministic demo, only writes to an explicitly isolated SITEFORGE_DATA_DIR."""
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
if not os.getenv('SITEFORGE_DATA_DIR'):
|
|
raise SystemExit('Please set SITEFORGE_DATA_DIR to a disposable directory first')
|
|
import sys
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
|
|
from app import db, multilingual, builder, theme_store
|
|
from app.core import save_entry, uid
|
|
|
|
db.init()
|
|
theme_store.setup()
|
|
multilingual.setup()
|
|
records=[('zh-CN','中文官网','https://zh.demo.example.org','/about/','关于我们','全球服务网络'),
|
|
('en','Global Website','https://en.demo.example.org','/company/','About Our Company','Worldwide service network')]
|
|
ids={}; content={}
|
|
for locale,name,domain,about,title,body in records:
|
|
sid=uid(); ids[locale]=sid
|
|
db.insert('''INSERT INTO sites VALUES (?,?,?,?,?,?,?,?,?,?,?)''',
|
|
(sid,name,domain,'SiteForge P6 international demonstration','corporate','#2563eb','','new','{}',db.now(),db.now()))
|
|
home=save_entry(sid,{'type':'page','title':name,'route':'/','body':f'<p>{body}</p>'})
|
|
detail=save_entry(sid,{'type':'page','title':title,'route':about,'body':f'<p>{body}</p>'})
|
|
content[locale]={'home':home,'about':detail}
|
|
gid=uid();db.insert('INSERT INTO language_groups VALUES (?,?,?,?)',(gid,'HESU multilingual demo','en',db.now()))
|
|
for locale in ids:db.insert('INSERT INTO language_sites VALUES (?,?,?)',(gid,ids[locale],locale))
|
|
for key in ('home','about'):
|
|
unit=uid();db.insert('INSERT INTO translation_units VALUES (?,?,?,?)',(unit,gid,key,db.now()))
|
|
for locale in ids:db.insert('INSERT INTO translation_members VALUES (?,?,?,?)',(unit,ids[locale],content[locale][key],'approved'))
|
|
for locale,sid in ids.items():
|
|
report=builder.build(sid)
|
|
print(json.dumps({'locale':locale,'site_id':sid,'build':report['version'],'pages':report['pages'],'alternates':report['alternate_pages'],'errors':report['errors'],'warnings':report['warnings'][:3]},ensure_ascii=False))
|