Files
paperclip-docker/patch-html.sh
Chaim 5160741248 Add Hebrew translation and RTL support via Docker injection
Injects custom CSS and JS into the Paperclip UI during Docker build:
- RTL layout overrides for Tailwind, Radix UI, and MDXEditor
- Hebrew translation script with MutationObserver for dynamic content
- Patch script to modify index.html with dir="rtl" and lang="he"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 20:42:19 +00:00

34 lines
1.1 KiB
Bash

#!/bin/bash
# patch-html.sh - Inject Hebrew RTL + translation into Paperclip UI
set -e
# Find the ui-dist directory in the global npm install
UI_DIR=$(find /usr/local/lib/node_modules/paperclipai -name "ui-dist" -type d | head -1)
if [ -z "$UI_DIR" ]; then
echo "ERROR: Could not find Paperclip ui-dist directory"
exit 1
fi
echo "Found ui-dist at: $UI_DIR"
# Copy assets
cp /tmp/rtl-override.css "$UI_DIR/assets/rtl-override.css"
cp /tmp/translate-he.js "$UI_DIR/assets/translate-he.js"
# Patch index.html:
# 1. Set dir="rtl" and lang="he"
sed -i 's/<html lang="en"/<html lang="he" dir="rtl"/' "$UI_DIR/index.html"
# 2. Inject RTL CSS and translation script before </head>
sed -i 's|</head>|<link rel="stylesheet" href="/assets/rtl-override.css">\n<script defer src="/assets/translate-he.js"></script>\n</head>|' "$UI_DIR/index.html"
# 3. Update page title
sed -i 's|<title>Paperclip</title>|<title>Paperclip - פייפרקליפ</title>|' "$UI_DIR/index.html"
echo "Hebrew RTL patch applied successfully"
echo "Patched files:"
echo " - $UI_DIR/index.html"
echo " - $UI_DIR/assets/rtl-override.css"
echo " - $UI_DIR/assets/translate-he.js"