diff --git a/README.md b/README.md index 2e8b33c4..68f96b7e 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,14 @@ upgrading Fern, also verify navigation, language switching, themes and history i Safari and Chrome. This guards a hosted-renderer failure; it does not patch WebKit's module loader or Fern's generated bundles. +The interface localization bridge preserves incoming server-rendered labels and +Fern's hydration strategies during language changes. It updates labels only after +island readiness and a post-render task. Within React-owned islands, read-only +React DOM binding markers also keep deferred Suspense content untouched until +React adopts each target. Only waiting targets are retried; disconnected nodes +are discarded. Verify these markers against the hosted renderer after Fern/React +upgrades. Do not normalize incoming labels to English. + The browser regression suite runs the checkout's configured custom scripts and CSS in Chromium and WebKit. Scripts follow their configured loading phases, preserving declaration order within each phase; Fern's parser, hydration and diff --git a/fern/docs-interface.js b/fern/docs-interface.js index 1a3c4a5d..fefc3317 100644 --- a/fern/docs-interface.js +++ b/fern/docs-interface.js @@ -5,13 +5,6 @@ // included; articles and embedded applications are never translated here. var interfaceDictionaries = {"en":{"Send":"Send","Copied!":"Copied!","Copy to clipboard":"Copy to clipboard","Copy page":"Copy page","Edit this page":"Edit this page","View as Markdown":"View as Markdown","Connect to Cursor":"Connect to Cursor","Connect to Claude Code":"Connect to Claude Code","More actions":"More actions","Scroll to top":"Scroll to top","Search":"Search","No results":"No results","Ask AI":"Ask AI","Ask a question":"Ask a question","Ask questions about this page":"Ask questions about this page","Assistant":"Assistant","Ask AI a question...":"Ask AI a question...","Responses are generated using AI and may contain mistakes.":"Responses are generated using AI and may contain mistakes.","Hi, I'm an AI assistant with access to documentation and other content.":"Hi, I'm an AI assistant with access to documentation and other content.","Tip: You can toggle this pane with":"Tip: You can toggle this pane with","Close search":"Close search","Filters":"Filters","Theme":"Theme","New chat":"New chat","Close chat":"Close chat","Maximize":"Maximize","Minimize":"Minimize","Was this page helpful?":"Was this page helpful?","Yes":"Yes","No":"No","Report incorrect code":"Report incorrect code","Up next":"Up next","Next":"Next","Previous":"Previous","On this page":"On this page","Last updated":"Last updated","Skip to navigation":"Skip to navigation","Copy this page as Markdown for LLMs":"Copy this page as Markdown for LLMs","View this page as plain text":"View this page as plain text","Install MCP server on Cursor":"Install MCP server on Cursor","Copy MCP server command for Claude Code":"Copy MCP server command for Claude Code","Open in ChatGPT":"Open in ChatGPT","Open in Claude":"Open in Claude","Open in Cursor":"Open in Cursor","Built with":"Built with"},"ar":{"Search":"بحث","Ask AI":"اسأل الذكاء الاصطناعي","Ask a question":"اطرح سؤالاً","Ask this page":"اسأل عن هذه الصفحة","Copy page":"نسخ الصفحة","Copied":"تم النسخ","Copied!":"تم النسخ!","Copy to clipboard":"نسخ إلى الحافظة","View as Markdown":"عرض بصيغة Markdown","View this page as plain text":"عرض الصفحة كنص عادي","Copy this page as Markdown for LLMs":"نسخ الصفحة بصيغة Markdown للنماذج اللغوية","More actions":"المزيد من الإجراءات","On this page":"في هذه الصفحة","Scroll to top":"العودة إلى الأعلى","Skip to navigation":"انتقل إلى التنقل","Was this page helpful?":"هل كانت هذه الصفحة مفيدة؟","Yes":"نعم","No":"لا","Edit this page":"تعديل هذه الصفحة","Next":"التالي","Previous":"السابق","Powered by":"بدعم من","Built with":"تم الإنشاء باستخدام","Launch App":"افتح التطبيق","Open menu":"فتح القائمة","Close menu":"إغلاق القائمة","Close search":"إغلاق البحث","No results found":"لم يتم العثور على نتائج","Suggestions":"اقتراحات","Results":"النتائج","Theme":"المظهر","Light":"فاتح","Dark":"داكن","System":"النظام","Assistant":"المساعد","Maximize":"تكبير","Minimize":"تصغير","New chat":"محادثة جديدة","Close chat":"إغلاق المحادثة","Send":"إرسال","Filters":"عوامل التصفية","AI-generated answers may contain mistakes.":"قد تحتوي الإجابات التي يولدها الذكاء الاصطناعي على أخطاء.","Responses are generated using AI and may contain mistakes.":"تُولَّد الإجابات باستخدام الذكاء الاصطناعي وقد تحتوي على أخطاء.","Hi, I'm an AI assistant with access to documentation and other content.":"مرحباً، أنا مساعد ذكاء اصطناعي يمكنه الوصول إلى الوثائق والمحتوى الآخر.","Tip: You can toggle this pane with":"نصيحة: يمكنك إظهار هذه اللوحة أو إخفاءها باستخدام","Ask AI a question...":"اطرح سؤالاً على الذكاء الاصطناعي...","Ask questions about this page":"اطرح أسئلة حول هذه الصفحة","Connect to Cursor":"الاتصال بـ Cursor","Install MCP server on Cursor":"تثبيت خادم MCP على Cursor","Connect to Claude Code":"الاتصال بـ Claude Code","Copy MCP server command for Claude Code":"نسخ أمر خادم MCP لـ Claude Code","Report incorrect code":"الإبلاغ عن كود غير صحيح","Open in ChatGPT":"افتح في ChatGPT","Open in Claude":"افتح في Claude","Open in Cursor":"افتح في Cursor","Open in Claude Code":"افتح في Claude Code"},"de":{"Send":"Senden","Copied!":"Kopiert!","Copy to clipboard":"In Zwischenablage kopieren","Copy page":"Seite kopieren","Edit this page":"Diese Seite bearbeiten","View as Markdown":"Als Markdown anzeigen","Connect to Cursor":"Mit Cursor verbinden","Connect to Claude Code":"Mit Claude Code verbinden","More actions":"Weitere Aktionen","Scroll to top":"Nach oben scrollen","Search":"Suchen","No results":"Keine Ergebnisse","Ask AI":"KI fragen","Ask a question":"Eine Frage stellen","Ask questions about this page":"Fragen zu dieser Seite stellen","Assistant":"Assistent","Ask AI a question...":"Stellen Sie der KI eine Frage...","Responses are generated using AI and may contain mistakes.":"Antworten werden mithilfe von KI generiert und können Fehler enthalten.","Hi, I'm an AI assistant with access to documentation and other content.":"Hallo, ich bin ein KI-Assistent mit Zugriff auf Dokumentation und andere Inhalte.","Tip: You can toggle this pane with":"Tipp: Sie können diesen Bereich umschalten mit","Close search":"Suche schließen","Filters":"Filtern","Theme":"Design","New chat":"Neuer Chat","Close chat":"Chat schließen","Maximize":"Maximieren","Minimize":"Minimieren","Was this page helpful?":"War diese Seite hilfreich?","Yes":"Ja","No":"Nein","Report incorrect code":"Fehlerhaften Code melden","Up next":"Als Nächstes","Next":"Weiter","Previous":"Zurück","On this page":"Auf dieser Seite","Last updated":"Zuletzt aktualisiert","Skip to navigation":"Zur Navigation springen","Copy this page as Markdown for LLMs":"Diese Seite als Markdown für LLMs kopieren","View this page as plain text":"Diese Seite als Klartext anzeigen","Install MCP server on Cursor":"MCP-Server auf Cursor installieren","Copy MCP server command for Claude Code":"MCP-Server-Befehl für Claude Code kopieren","Open in ChatGPT":"In ChatGPT öffnen","Open in Claude":"In Claude öffnen","Open in Cursor":"In Cursor öffnen","Built with":"Erstellt mit"},"el":{"Send":"Αποστολή","Copied!":"Αντιγράφηκε!","Copy to clipboard":"Αντιγραφή στο πρόχειρο","Copy page":"Αντιγραφή σελίδας","Edit this page":"Επεξεργασία αυτής της σελίδας","View as Markdown":"Προβολή ως Markdown","Connect to Cursor":"Σύνδεση στο Cursor","Connect to Claude Code":"Σύνδεση στο Claude Code","More actions":"Περισσότερες ενέργειες","Scroll to top":"Κύλιση στην κορυφή","Search":"Αναζήτηση","No results":"Κανένα αποτέλεσμα","Ask AI":"Ρωτήστε το AI","Ask a question":"Κάντε μια ερώτηση","Ask questions about this page":"Κάντε ερωτήσεις σχετικά με αυτήν τη σελίδα","Assistant":"Βοηθός","Ask AI a question...":"Ρωτήστε το AI μια ερώτηση...","Responses are generated using AI and may contain mistakes.":"Οι απαντήσεις δημιουργούνται με χρήση AI και ενδέχεται να περιέχουν σφάλματα.","Hi, I'm an AI assistant with access to documentation and other content.":"Γεια, είμαι ένας βοηθός AI με πρόσβαση σε τεκμηρίωση και άλλο περιεχόμενο.","Tip: You can toggle this pane with":"Συμβουλή: Μπορείτε να εναλλάξετε αυτό το παράθυρο με","Close search":"Κλείσιμο αναζήτησης","Filters":"Φίλτρα","Theme":"Θέμα","New chat":"Νέα συνομιλία","Close chat":"Κλείσιμο συνομιλίας","Maximize":"Μεγιστοποίηση","Minimize":"Ελαχιστοποίηση","Was this page helpful?":"Ήταν χρήσιμη αυτή η σελίδα;","Yes":"Ναι","No":"Όχι","Report incorrect code":"Αναφορά εσφαλμένου κώδικα","Up next":"Επόμενο","Next":"Επόμενο","Previous":"Προηγούμενο","On this page":"Σε αυτήν τη σελίδα","Last updated":"Τελευταία ενημέρωση","Skip to navigation":"Μετάβαση στην πλοήγηση","Copy this page as Markdown for LLMs":"Αντιγραφή αυτής της σελίδας ως Markdown για LLMs","View this page as plain text":"Προβολή αυτής της σελίδας ως απλό κείμενο","Install MCP server on Cursor":"Εγκατάσταση διακομιστή MCP στο Cursor","Copy MCP server command for Claude Code":"Αντιγραφή εντολής διακομιστή MCP για Claude Code","Open in ChatGPT":"Άνοιγμα στο ChatGPT","Open in Claude":"Άνοιγμα στο Claude","Open in Cursor":"Άνοιγμα στο Cursor","Built with":"Δημιουργήθηκε με"},"es":{"Send":"Enviar","Copied!":"¡Copiado!","Copy to clipboard":"Copiar al portapapeles","Copy page":"Copiar página","Edit this page":"Editar esta página","View as Markdown":"Ver como Markdown","Connect to Cursor":"Conectar a Cursor","Connect to Claude Code":"Conectar a Claude Code","More actions":"Más acciones","Scroll to top":"Ir arriba","Search":"Buscar","No results":"Sin resultados","Ask AI":"Preguntar a IA","Ask a question":"Hacer una pregunta","Ask questions about this page":"Hacer preguntas sobre esta página","Assistant":"Asistente","Ask AI a question...":"Haz una pregunta a la IA...","Responses are generated using AI and may contain mistakes.":"Las respuestas se generan mediante IA y pueden contener errores.","Hi, I'm an AI assistant with access to documentation and other content.":"Hola, soy un asistente de IA con acceso a documentación y otros contenidos.","Tip: You can toggle this pane with":"Consejo: Puedes alternar este panel con","Close search":"Cerrar búsqueda","Filters":"Filtros","Theme":"Tema","New chat":"Nuevo chat","Close chat":"Cerrar chat","Maximize":"Maximizar","Minimize":"Minimizar","Was this page helpful?":"¿Te fue útil esta página?","Yes":"Sí","No":"No","Report incorrect code":"Reportar código incorrecto","Up next":"A continuación","Next":"Siguiente","Previous":"Anterior","On this page":"En esta página","Last updated":"Última actualización","Skip to navigation":"Saltar a la navegación","Copy this page as Markdown for LLMs":"Copiar esta página como Markdown para LLMs","View this page as plain text":"Ver esta página como texto plano","Install MCP server on Cursor":"Instalar servidor MCP en Cursor","Copy MCP server command for Claude Code":"Copiar comando del servidor MCP para Claude Code","Open in ChatGPT":"Abrir en ChatGPT","Open in Claude":"Abrir en Claude","Open in Cursor":"Abrir en Cursor","Built with":"Construido con"},"fr":{"Send":"Envoyer","Copied!":"Copié !","Copy to clipboard":"Copier dans le presse-papiers","Copy page":"Copier la page","Edit this page":"Modifier cette page","View as Markdown":"Afficher en Markdown","Connect to Cursor":"Connecter à Cursor","Connect to Claude Code":"Connecter à Claude Code","More actions":"Plus d'actions","Scroll to top":"Retour en haut","Search":"Rechercher","No results":"Aucun résultat","Ask AI":"Demander à l'IA","Ask a question":"Poser une question","Ask questions about this page":"Poser des questions sur cette page","Assistant":"Assistant","Ask AI a question...":"Posez une question à l'IA...","Responses are generated using AI and may contain mistakes.":"Les réponses sont générées par IA et peuvent contenir des erreurs.","Hi, I'm an AI assistant with access to documentation and other content.":"Bonjour, je suis un assistant IA avec accès à la documentation et autres contenus.","Tip: You can toggle this pane with":"Astuce : Vous pouvez basculer ce panneau avec","Close search":"Fermer la recherche","Filters":"Filtres","Theme":"Thème","New chat":"Nouvelle conversation","Close chat":"Fermer la conversation","Maximize":"Agrandir","Minimize":"Réduire","Was this page helpful?":"Cette page a-t-elle été utile ?","Yes":"Oui","No":"Non","Report incorrect code":"Signaler un code incorrect","Up next":"À suivre","Next":"Suivant","Previous":"Précédent","On this page":"Sur cette page","Last updated":"Dernière mise à jour","Skip to navigation":"Passer à la navigation","Copy this page as Markdown for LLMs":"Copier cette page en Markdown pour les LLM","View this page as plain text":"Afficher cette page en texte brut","Install MCP server on Cursor":"Installer le serveur MCP sur Cursor","Copy MCP server command for Claude Code":"Copier la commande du serveur MCP pour Claude Code","Open in ChatGPT":"Ouvrir dans ChatGPT","Open in Claude":"Ouvrir dans Claude","Open in Cursor":"Ouvrir dans Cursor","Built with":"Construit avec"},"it":{"Send":"Invia","Copied!":"Copiato!","Copy to clipboard":"Copia negli appunti","Copy page":"Copia pagina","Edit this page":"Modifica questa pagina","View as Markdown":"Visualizza come Markdown","Connect to Cursor":"Connetti a Cursor","Connect to Claude Code":"Connetti a Claude Code","More actions":"Altre azioni","Scroll to top":"Torna in alto","Search":"Cerca","No results":"Nessun risultato","Ask AI":"Chiedi all'IA","Ask a question":"Fai una domanda","Ask questions about this page":"Fai domande su questa pagina","Assistant":"Assistente","Ask AI a question...":"Fai una domanda all'IA...","Responses are generated using AI and may contain mistakes.":"Le risposte sono generate tramite IA e potrebbero contenere errori.","Hi, I'm an AI assistant with access to documentation and other content.":"Ciao, sono un assistente IA con accesso alla documentazione e altri contenuti.","Tip: You can toggle this pane with":"Suggerimento: Puoi attivare/disattivare questo pannello con","Close search":"Chiudi ricerca","Filters":"Filtri","Theme":"Tema","New chat":"Nuova chat","Close chat":"Chiudi chat","Maximize":"Ingrandisci","Minimize":"Riduci","Was this page helpful?":"Questa pagina è stata utile?","Yes":"Sì","No":"No","Report incorrect code":"Segnala codice errato","Up next":"Prossimo","Next":"Avanti","Previous":"Precedente","On this page":"In questa pagina","Last updated":"Ultimo aggiornamento","Skip to navigation":"Vai alla navigazione","Copy this page as Markdown for LLMs":"Copia questa pagina come Markdown per LLM","View this page as plain text":"Visualizza questa pagina come testo normale","Install MCP server on Cursor":"Installa server MCP su Cursor","Copy MCP server command for Claude Code":"Copia comando server MCP per Claude Code","Open in ChatGPT":"Apri in ChatGPT","Open in Claude":"Apri in Claude","Open in Cursor":"Apri in Cursor","Built with":"Costruito con"},"ja":{"Send":"送信","Copied!":"コピーしました!","Copy to clipboard":"クリップボードにコピー","Copy page":"ページをコピー","Edit this page":"このページを編集","View as Markdown":"Markdownとして表示","Connect to Cursor":"Cursorに接続","Connect to Claude Code":"Claude Codeに接続","More actions":"その他のアクション","Scroll to top":"トップに戻る","Search":"検索","No results":"結果なし","Ask AI":"AIに質問","Ask a question":"質問する","Ask questions about this page":"このページについて質問する","Assistant":"アシスタント","Ask AI a question...":"AIに質問する...","Responses are generated using AI and may contain mistakes.":"回答はAIを使用して生成されており、誤りを含む場合があります。","Hi, I'm an AI assistant with access to documentation and other content.":"こんにちは、私はドキュメントやその他のコンテンツにアクセスできるAIアシスタントです。","Tip: You can toggle this pane with":"ヒント:このペインは次の方法で切り替えることができます","Close search":"検索を閉じる","Filters":"フィルター","Theme":"テーマ","New chat":"新しいチャット","Close chat":"チャットを閉じる","Maximize":"最大化","Minimize":"最小化","Was this page helpful?":"このページは役に立ちましたか?","Yes":"はい","No":"いいえ","Report incorrect code":"誤ったコードを報告","Up next":"次へ","Next":"次へ","Previous":"前へ","On this page":"このページ内","Last updated":"最終更新日","Skip to navigation":"ナビゲーションにスキップ","Copy this page as Markdown for LLMs":"このページをLLM用のMarkdownとしてコピー","View this page as plain text":"このページをプレーンテキストとして表示","Install MCP server on Cursor":"CursorにMCPサーバーをインストール","Copy MCP server command for Claude Code":"Claude Code用MCPサーバーコマンドをコピー","Open in ChatGPT":"ChatGPTで開く","Open in Claude":"Claudeで開く","Open in Cursor":"Cursorで開く","Built with":"で構築済み"},"ko":{"Send":"보내기","Copied!":"복사됨!","Copy to clipboard":"클립보드에 복사","Copy page":"페이지 복사","Edit this page":"이 페이지 편집","View as Markdown":"Markdown으로 보기","Connect to Cursor":"Cursor에 연결","Connect to Claude Code":"Claude Code에 연결","More actions":"더 많은 작업","Scroll to top":"맨 위로","Search":"검색","No results":"결과 없음","Ask AI":"AI에게 질문","Ask a question":"질문하기","Ask questions about this page":"이 페이지에 대해 질문하기","Assistant":"도우미","Ask AI a question...":"AI에게 질문하기...","Responses are generated using AI and may contain mistakes.":"응답은 AI를 사용하여 생성되며 오류가 포함될 수 있습니다.","Hi, I'm an AI assistant with access to documentation and other content.":"안녕하세요, 저는 문서 및 기타 콘텐츠에 액세스할 수 있는 AI 도우미입니다.","Tip: You can toggle this pane with":"팁: 이 창을 다음으로 전환할 수 있습니다","Close search":"검색 닫기","Filters":"필터","Theme":"테마","New chat":"새 채팅","Close chat":"채팅 닫기","Maximize":"최대화","Minimize":"최소화","Was this page helpful?":"이 페이지가 도움이 되었나요?","Yes":"예","No":"아니오","Report incorrect code":"잘못된 코드 신고","Up next":"다음","Next":"다음","Previous":"이전","On this page":"이 페이지에서","Last updated":"마지막 업데이트","Skip to navigation":"탐색으로 건너뛰기","Copy this page as Markdown for LLMs":"LLM용 Markdown으로 이 페이지 복사","View this page as plain text":"이 페이지를 일반 텍스트로 보기","Install MCP server on Cursor":"Cursor에 MCP 서버 설치","Copy MCP server command for Claude Code":"Claude Code용 MCP 서버 명령어 복사","Open in ChatGPT":"ChatGPT에서 열기","Open in Claude":"Claude에서 열기","Open in Cursor":"Cursor에서 열기","Built with":"구축됨"},"pl":{"Send":"Wyślij","Copied!":"Skopiowano!","Copy to clipboard":"Skopiuj do schowka","Copy page":"Skopiuj stronę","Edit this page":"Edytuj tę stronę","View as Markdown":"Zobacz jako Markdown","Connect to Cursor":"Połącz z Cursor","Connect to Claude Code":"Połącz z Claude Code","More actions":"Więcej działań","Scroll to top":"Powrót na górę","Search":"Szukaj","No results":"Brak wyników","Ask AI":"Zapytaj AI","Ask a question":"Zadaj pytanie","Ask questions about this page":"Zadaj pytania dotyczące tej strony","Assistant":"Asystent","Ask AI a question...":"Zadaj pytanie AI...","Responses are generated using AI and may contain mistakes.":"Odpowiedzi są generowane przy użyciu AI i mogą zawierać błędy.","Hi, I'm an AI assistant with access to documentation and other content.":"Cześć, jestem asystentem AI z dostępem do dokumentacji i innych treści.","Tip: You can toggle this pane with":"Wskazówka: Możesz przełączać ten panel za pomocą","Close search":"Zamknij wyszukiwanie","Filters":"Filtry","Theme":"Motyw","New chat":"Nowy czat","Close chat":"Zamknij czat","Maximize":"Maksymalizuj","Minimize":"Minimalizuj","Was this page helpful?":"Czy ta strona była pomocna?","Yes":"Tak","No":"Nie","Report incorrect code":"Zgłoś nieprawidłowy kod","Up next":"Następny","Next":"Następny","Previous":"Poprzedni","On this page":"Na tej stronie","Last updated":"Ostatnia aktualizacja","Skip to navigation":"Przejdź do nawigacji","Copy this page as Markdown for LLMs":"Skopiuj tę stronę jako Markdown dla LLM","View this page as plain text":"Zobacz tę stronę jako zwykły tekst","Install MCP server on Cursor":"Zainstaluj serwer MCP na Cursor","Copy MCP server command for Claude Code":"Skopiuj polecenie serwera MCP dla Claude Code","Open in ChatGPT":"Otwórz w ChatGPT","Open in Claude":"Otwórz w Claude","Open in Cursor":"Otwórz w Cursor","Built with":"Zbudowano z"},"pt":{"Send":"Enviar","Copied!":"Copiado!","Copy to clipboard":"Copiar para a área de transferência","Copy page":"Copiar página","Edit this page":"Editar esta página","View as Markdown":"Ver como Markdown","Connect to Cursor":"Conectar ao Cursor","Connect to Claude Code":"Conectar ao Claude Code","More actions":"Mais ações","Scroll to top":"Voltar ao topo","Search":"Pesquisar","No results":"Sem resultados","Ask AI":"Perguntar à IA","Ask a question":"Fazer uma pergunta","Ask questions about this page":"Fazer perguntas sobre esta página","Assistant":"Assistente","Ask AI a question...":"Faça uma pergunta à IA...","Responses are generated using AI and may contain mistakes.":"As respostas são geradas por IA e podem conter erros.","Hi, I'm an AI assistant with access to documentation and other content.":"Olá, sou um assistente de IA com acesso à documentação e outros conteúdos.","Tip: You can toggle this pane with":"Dica: Você pode alternar este painel com","Close search":"Fechar pesquisa","Filters":"Filtros","Theme":"Tema","New chat":"Novo chat","Close chat":"Fechar chat","Maximize":"Maximizar","Minimize":"Minimizar","Was this page helpful?":"Esta página foi útil?","Yes":"Sim","No":"Não","Report incorrect code":"Relatar código incorreto","Up next":"A seguir","Next":"Próximo","Previous":"Anterior","On this page":"Nesta página","Last updated":"Última atualização","Skip to navigation":"Ir para a navegação","Copy this page as Markdown for LLMs":"Copiar esta página como Markdown para LLMs","View this page as plain text":"Ver esta página como texto simples","Install MCP server on Cursor":"Instalar servidor MCP no Cursor","Copy MCP server command for Claude Code":"Copiar comando do servidor MCP para Claude Code","Open in ChatGPT":"Abrir no ChatGPT","Open in Claude":"Abrir no Claude","Open in Cursor":"Abrir no Cursor","Built with":"Construído com"},"ru":{"Send":"Отправить","Copied!":"Скопировано!","Copy to clipboard":"Копировать в буфер обмена","Copy page":"Копировать страницу","Edit this page":"Редактировать эту страницу","View as Markdown":"Просмотр в формате Markdown","Connect to Cursor":"Подключиться к Cursor","Connect to Claude Code":"Подключиться к Claude Code","More actions":"Дополнительные действия","Scroll to top":"Наверх","Search":"Поиск","No results":"Нет результатов","Ask AI":"Спросить ИИ","Ask a question":"Задать вопрос","Ask questions about this page":"Задать вопросы об этой странице","Assistant":"Ассистент","Ask AI a question...":"Задайте вопрос ИИ...","Responses are generated using AI and may contain mistakes.":"Ответы сгенерированы с помощью ИИ и могут содержать ошибки.","Hi, I'm an AI assistant with access to documentation and other content.":"Здравствуйте, я ИИ-ассистент с доступом к документации и другому контенту.","Tip: You can toggle this pane with":"Подсказка: Вы можете переключать эту панель с помощью","Close search":"Закрыть поиск","Filters":"Фильтры","Theme":"Тема","New chat":"Новый чат","Close chat":"Закрыть чат","Maximize":"Развернуть","Minimize":"Свернуть","Was this page helpful?":"Была ли эта страница полезной?","Yes":"Да","No":"Нет","Report incorrect code":"Сообщить о неправильном коде","Up next":"Далее","Next":"Следующий","Previous":"Предыдущий","On this page":"На этой странице","Last updated":"Последнее обновление","Skip to navigation":"Перейти к навигации","Copy this page as Markdown for LLMs":"Копировать эту страницу как Markdown для LLM","View this page as plain text":"Просмотреть эту страницу как обычный текст","Install MCP server on Cursor":"Установить сервер MCP на Cursor","Copy MCP server command for Claude Code":"Скопировать команду сервера MCP для Claude Code","Open in ChatGPT":"Открыть в ChatGPT","Open in Claude":"Открыть в Claude","Open in Cursor":"Открыть в Cursor","Built with":"Создано с помощью"},"tr":{"Send":"Gönder","Copied!":"Kopyalandı!","Copy to clipboard":"Panoya kopyala","Copy page":"Sayfayı kopyala","Edit this page":"Bu sayfayı düzenle","View as Markdown":"Markdown olarak görüntüle","Connect to Cursor":"Cursor'a bağlan","Connect to Claude Code":"Claude Code'a bağlan","More actions":"Daha fazla işlem","Scroll to top":"Başa dön","Search":"Ara","No results":"Sonuç yok","Ask AI":"Yapay zekaya sor","Ask a question":"Bir soru sor","Ask questions about this page":"Bu sayfa hakkında sorular sor","Assistant":"Asistan","Ask AI a question...":"Yapay zekaya bir soru sorun...","Responses are generated using AI and may contain mistakes.":"Yanıtlar yapay zeka kullanılarak oluşturulmuştur ve hatalar içerebilir.","Hi, I'm an AI assistant with access to documentation and other content.":"Merhaba, dokümantasyona ve diğer içeriklere erişimi olan bir yapay zeka asistanıyım.","Tip: You can toggle this pane with":"İpucu: Bu paneli şununla değiştirebilirsiniz","Close search":"Aramayı kapat","Filters":"Filtreler","Theme":"Temalar","New chat":"Yeni sohbet","Close chat":"Sohbeti kapat","Maximize":"Büyüt","Minimize":"Küçült","Was this page helpful?":"Bu sayfa yardımcı oldu mu?","Yes":"Evet","No":"Hayır","Report incorrect code":"Hatalı kodu bildir","Up next":"Sıradaki","Next":"İleri","Previous":"Geri","On this page":"Bu sayfada","Last updated":"Son güncelleme","Skip to navigation":"Gezinmeye atla","Copy this page as Markdown for LLMs":"Bu sayfayı LLM'ler için Markdown olarak kopyala","View this page as plain text":"Bu sayfayı düz metin olarak görüntüle","Install MCP server on Cursor":"Cursor'a MCP sunucusunu yükle","Copy MCP server command for Claude Code":"Claude Code için MCP sunucu komutunu kopyala","Open in ChatGPT":"ChatGPT'de aç","Open in Claude":"Claude'da aç","Open in Cursor":"Cursor'da aç","Built with":"İle oluşturuldu"},"zh":{"Send":"发送","Copied!":"已复制!","Copy to clipboard":"复制到剪贴板","Copy page":"复制页面","Edit this page":"编辑此页面","View as Markdown":"以 Markdown 格式查看","Connect to Cursor":"连接到 Cursor","Connect to Claude Code":"连接到 Claude Code","More actions":"更多操作","Scroll to top":"返回顶部","Search":"搜索","No results":"无结果","Ask AI":"询问 AI","Ask a question":"提问","Ask questions about this page":"询问有关此页面的问题","Assistant":"助手","Ask AI a question...":"向 AI 提问...","Responses are generated using AI and may contain mistakes.":"回答由AI生成,可能包含错误。","Hi, I'm an AI assistant with access to documentation and other content.":"您好,我是一个可以访问文档和其他内容的 AI 助手。","Tip: You can toggle this pane with":"提示:您可以使用以下方式切换此面板","Close search":"关闭搜索","Filters":"筛选器","Theme":"主题","New chat":"新对话","Close chat":"关闭对话","Maximize":"最大化","Minimize":"最小化","Was this page helpful?":"此页面是否有帮助?","Yes":"是","No":"否","Report incorrect code":"报告错误代码","Up next":"接下来","Next":"下一个","Previous":"上一个","On this page":"在本页","Last updated":"最后更新","Skip to navigation":"跳到导航","Copy this page as Markdown for LLMs":"将此页面复制为 LLM 的 Markdown","View this page as plain text":"以纯文本查看此页面","Install MCP server on Cursor":"在 Cursor 上安装 MCP 服务器","Copy MCP server command for Claude Code":"复制 Claude Code 的 MCP 服务器命令","Open in ChatGPT":"在 ChatGPT 中打开","Open in Claude":"在 Claude 中打开","Open in Cursor":"在 Cursor 中打开","Built with":"使用以下工具构建完成"},"zh-TW":{"Send":"Send","Copied!":"Copied!","Copy to clipboard":"Copy to clipboard","Copy page":"複製頁面","Edit this page":"編輯此頁面","View as Markdown":"以 Markdown 格式查看","Connect to Cursor":"Connect to Cursor","Connect to Claude Code":"Connect to Claude Code","More actions":"更多操作","Scroll to top":"回到頂部","Search":"搜尋","No results":"No results","Ask AI":"詢問 AI","Ask a question":"提問","Ask questions about this page":"Ask questions about this page","Assistant":"Assistant","Ask AI a question...":"Ask AI a question...","Responses are generated using AI and may contain mistakes.":"Responses are generated using AI and may contain mistakes.","Hi, I'm an AI assistant with access to documentation and other content.":"Hi, I'm an AI assistant with access to documentation and other content.","Tip: You can toggle this pane with":"Tip: You can toggle this pane with","Close search":"關閉搜尋","Filters":"Filters","Theme":"Theme","New chat":"New chat","Close chat":"Close chat","Maximize":"Maximize","Minimize":"Minimize","Was this page helpful?":"此頁面有幫助嗎?","Yes":"是","No":"否","Report incorrect code":"Report incorrect code","Up next":"Up next","Next":"下一頁","Previous":"上一頁","On this page":"本頁內容","Last updated":"Last updated","Skip to navigation":"Skip to navigation","Copy this page as Markdown for LLMs":"Copy this page as Markdown for LLMs","View this page as plain text":"View this page as plain text","Install MCP server on Cursor":"Install MCP server on Cursor","Copy MCP server command for Claude Code":"Copy MCP server command for Claude Code","Open in ChatGPT":"Open in ChatGPT","Open in Claude":"Open in Claude","Open in Cursor":"Open in Cursor","Built with":"Built with","Open menu":"開啟選單","Close menu":"關閉選單","No results found":"找不到結果","Light":"淺色","Dark":"深色","System":"跟隨系統","Launch App":"開啟應用"},"id":{"Send":"Kirim","Copied!":"Disalin!","Copy to clipboard":"Salin ke papan klip","Copy page":"Salin halaman","Edit this page":"Edit halaman ini","View as Markdown":"Lihat sebagai Markdown","Connect to Cursor":"Hubungkan ke Cursor","Connect to Claude Code":"Hubungkan ke Claude Code","More actions":"Tindakan lainnya","Scroll to top":"Kembali ke atas","Search":"Cari","No results":"Tidak ada hasil","Ask AI":"Tanya AI","Ask a question":"Ajukan pertanyaan","Ask questions about this page":"Ajukan pertanyaan tentang halaman ini","Assistant":"Asisten","Ask AI a question...":"Ajukan pertanyaan kepada AI...","Responses are generated using AI and may contain mistakes.":"Jawaban dibuat oleh AI dan mungkin mengandung kesalahan.","Hi, I'm an AI assistant with access to documentation and other content.":"Halo, saya asisten AI dengan akses ke dokumentasi dan konten lainnya.","Tip: You can toggle this pane with":"Tips: Anda dapat membuka atau menutup panel ini dengan","Close search":"Tutup pencarian","Filters":"Filter","Theme":"Tema","New chat":"Obrolan baru","Close chat":"Tutup obrolan","Maximize":"Perbesar","Minimize":"Perkecil","Was this page helpful?":"Apakah halaman ini membantu?","Yes":"Ya","No":"Tidak","Report incorrect code":"Laporkan kode yang salah","Up next":"Berikutnya","Next":"Berikutnya","Previous":"Sebelumnya","On this page":"Di halaman ini","Last updated":"Terakhir diperbarui","Skip to navigation":"Lewati ke navigasi","Copy this page as Markdown for LLMs":"Salin halaman ini sebagai Markdown untuk LLM","View this page as plain text":"Lihat halaman ini sebagai teks biasa","Install MCP server on Cursor":"Pasang server MCP di Cursor","Copy MCP server command for Claude Code":"Salin perintah server MCP untuk Claude Code","Open in ChatGPT":"Buka di ChatGPT","Open in Claude":"Buka di Claude","Open in Cursor":"Buka di Cursor","Built with":"Dibuat dengan","Open menu":"Buka menu","Close menu":"Tutup menu","No results found":"Tidak ada hasil","Light":"Terang","Dark":"Gelap","System":"Sistem","Launch App":"Buka aplikasi"},"uk":{"Send":"Надіслати","Copied!":"Скопійовано!","Copy to clipboard":"Копіювати до буфера обміну","Copy page":"Копіювати сторінку","Edit this page":"Редагувати сторінку","View as Markdown":"Переглянути як Markdown","Connect to Cursor":"Підключити до Cursor","Connect to Claude Code":"Підключити до Claude Code","More actions":"Інші дії","Scroll to top":"На початок","Search":"Пошук","No results":"Немає результатів","Ask AI":"Запитати ШІ","Ask a question":"Поставити запитання","Ask questions about this page":"Поставити запитання про цю сторінку","Assistant":"Помічник","Ask AI a question...":"Поставте запитання ШІ...","Responses are generated using AI and may contain mistakes.":"Відповіді створює ШІ, і вони можуть містити помилки.","Hi, I'm an AI assistant with access to documentation and other content.":"Вітаю, я помічник ШІ з доступом до документації та іншого вмісту.","Tip: You can toggle this pane with":"Порада: цю панель можна перемикати за допомогою","Close search":"Закрити пошук","Filters":"Фільтри","Theme":"Тема","New chat":"Новий чат","Close chat":"Закрити чат","Maximize":"Розгорнути","Minimize":"Згорнути","Was this page helpful?":"Чи була ця сторінка корисною?","Yes":"Так","No":"Ні","Report incorrect code":"Повідомити про неправильний код","Up next":"Далі","Next":"Далі","Previous":"Назад","On this page":"На цій сторінці","Last updated":"Останнє оновлення","Skip to navigation":"Перейти до навігації","Copy this page as Markdown for LLMs":"Копіювати цю сторінку як Markdown для LLM","View this page as plain text":"Переглянути сторінку як звичайний текст","Install MCP server on Cursor":"Встановити сервер MCP у Cursor","Copy MCP server command for Claude Code":"Копіювати команду сервера MCP для Claude Code","Open in ChatGPT":"Відкрити в ChatGPT","Open in Claude":"Відкрити в Claude","Open in Cursor":"Відкрити в Cursor","Built with":"Створено за допомогою","Open menu":"Відкрити меню","Close menu":"Закрити меню","No results found":"Результатів не знайдено","Light":"Світла","Dark":"Темна","System":"Системна","Launch App":"Відкрити застосунок"},"vi":{"Send":"Gửi","Copied!":"Đã sao chép!","Copy to clipboard":"Sao chép vào bộ nhớ tạm","Copy page":"Sao chép trang","Edit this page":"Chỉnh sửa trang","View as Markdown":"Xem dưới dạng Markdown","Connect to Cursor":"Kết nối với Cursor","Connect to Claude Code":"Kết nối với Claude Code","More actions":"Thao tác khác","Scroll to top":"Về đầu trang","Search":"Tìm kiếm","No results":"Không có kết quả","Ask AI":"Hỏi AI","Ask a question":"Đặt câu hỏi","Ask questions about this page":"Đặt câu hỏi về trang này","Assistant":"Trợ lý","Ask AI a question...":"Đặt câu hỏi cho AI...","Responses are generated using AI and may contain mistakes.":"Câu trả lời do AI tạo ra và có thể có sai sót.","Hi, I'm an AI assistant with access to documentation and other content.":"Xin chào, tôi là trợ lý AI có quyền truy cập tài liệu và nội dung khác.","Tip: You can toggle this pane with":"Mẹo: Bạn có thể bật hoặc tắt bảng này bằng","Close search":"Đóng tìm kiếm","Filters":"Bộ lọc","Theme":"Giao diện","New chat":"Cuộc trò chuyện mới","Close chat":"Đóng cuộc trò chuyện","Maximize":"Phóng to","Minimize":"Thu nhỏ","Was this page helpful?":"Trang này có hữu ích không?","Yes":"Có","No":"Không","Report incorrect code":"Báo cáo mã không chính xác","Up next":"Tiếp theo","Next":"Tiếp theo","Previous":"Trước","On this page":"Trên trang này","Last updated":"Cập nhật lần cuối","Skip to navigation":"Chuyển đến điều hướng","Copy this page as Markdown for LLMs":"Sao chép trang này dưới dạng Markdown cho LLM","View this page as plain text":"Xem trang này dưới dạng văn bản thuần","Install MCP server on Cursor":"Cài đặt máy chủ MCP trên Cursor","Copy MCP server command for Claude Code":"Sao chép lệnh máy chủ MCP cho Claude Code","Open in ChatGPT":"Mở trong ChatGPT","Open in Claude":"Mở trong Claude","Open in Cursor":"Mở trong Cursor","Built with":"Được tạo bằng","Open menu":"Mở menu","Close menu":"Đóng menu","No results found":"Không tìm thấy kết quả","Light":"Sáng","Dark":"Tối","System":"Hệ thống","Launch App":"Mở ứng dụng"}}; var interfaceAliases = [["Im Dashboard bearbeiten","Edit this page"],["Fragen Sie nach dieser Seite","Ask questions about this page"],["Επεξεργασία στο Dashboard","Edit this page"],["Ζητήστε ερωτήσεις για αυτήν τη σελίδα","Ask questions about this page"],["Editar en el Dashboard","Edit this page"],["Modifier dans le Dashboard","Edit this page"],["Copier cette page comme Markdown pour LLMs","Copy this page as Markdown for LLMs"],["Modifica nel Dashboard","Edit this page"],["Copia questa pagina come Markdown per LLMs","Copy this page as Markdown for LLMs"],["ダッシュボードで編集","Edit this page"],["대시보드에서 편집","Edit this page"],["이 페이지를 LLM용 Markdown으로 복사","Copy this page as Markdown for LLMs"],["Edytuj w Dashboard","Edit this page"],["Kopiuj tę stronę jako Markdown dla LLMs","Copy this page as Markdown for LLMs"],["Zadaj pytania o tę stronę","Ask questions about this page"],["Editar no Dashboard","Edit this page"],["Редактировать в Dashboard","Edit this page"],["Скопировать эту страницу как Markdown для LLMs","Copy this page as Markdown for LLMs"],["Dashboard'da düzenle","Edit this page"],["Bu sayfaya sorular sor","Ask questions about this page"],["在仪表板中编辑","Edit this page"],["将此页面复制为 Markdown 用于 LLMs","Copy this page as Markdown for LLMs"],["询问此页面","Ask questions about this page"]]; - var initialLanguage = document.documentElement.lang || 'en'; - // Additional controls are localized after hydration; retain Fern native SSR dictionaries. - // Each dictionary contains only string labels; copy its entries independently. - var nativeDictionaries = {}; - Object.keys(interfaceDictionaries).forEach(function (lang) { - nativeDictionaries[lang] = Object.assign({}, interfaceDictionaries[lang]); - }); var themeLabels = {"en":["Light","Dark","System"],"de":["Hell","Dunkel","System"],"el":["Φωτεινό","Σκοτεινό","Σύστημα"],"es":["Claro","Oscuro","Sistema"],"fr":["Clair","Sombre","Système"],"it":["Chiaro","Scuro","Sistema"],"ja":["ライト","ダーク","システム"],"ko":["라이트","다크","시스템"],"pl":["Jasny","Ciemny","Systemowy"],"pt":["Claro","Escuro","Sistema"],"ru":["Светлая","Тёмная","Системная"],"tr":["Açık","Koyu","Sistem"],"zh-CN":["浅色","深色","跟随系统"],"zh-TW":["淺色","深色","跟隨系統"],"ar":["فاتح","داكن","النظام"],"id":["Terang","Gelap","Sistem"],"uk":["Світла","Темна","Системна"],"vi":["Sáng","Tối","Hệ thống"]}; Object.keys(themeLabels).forEach(function (lang) { var target = interfaceDictionaries[lang] || interfaceDictionaries[lang.split('-')[0]]; @@ -32,6 +25,9 @@ var uiObserver; var dirtyRoots = new Set(); var fullSyncRequested = false; + var reactBindingKeys = new WeakMap(); + var pendingBindings = new Set(); + var bindingRetry = 0; var translatedAttributes = ['aria-label','title','placeholder']; function locale() { var first = window.location.pathname.split('/').filter(Boolean)[0] || ''; @@ -40,34 +36,70 @@ function dictionary(lang) { return interfaceDictionaries[lang] || interfaceDictionaries[lang.split('-')[0]] || interfaceDictionaries.en; } - function translate(value, selected, beforeHydration) { + function translate(value, selected) { var text = value.trim(), suffix = text.endsWith(':') ? ':' : '', key = reverseLabels.get(suffix ? text.slice(0,-1) : text); - var replacement = key && (selected[key] || (beforeHydration ? key : undefined)); + var replacement = key && selected[key]; return replacement ? value.replace(text, replacement + suffix) : value; } + function retryPendingBindings() { + if (bindingRetry) return; + bindingRetry = window.setTimeout(function () { + bindingRetry = 0; + var pending = Array.from(pendingBindings); + pendingBindings.clear(); + pending.forEach(function (element) { + if (element.isConnected && isHydrated(element)) schedule(); + }); + }, 50); + } function isHydrated(element) { var island = element.closest && element.closest('astro-island'); + var bindingKey = null; + var bindingRootFound = false; while (island) { if (!island.hasAttribute('data-fern-hydrated')) return false; + if (!bindingRootFound) { + var key = reactBindingKeys.get(island); + if (!key) { + // Read-only React DOM ownership check. The outer Fern readiness effect + // can run while a nested Suspense boundary still contains untouched SSR. + var containerKey = Object.keys(island).find(function (name) { return name.indexOf('__reactContainer$') === 0; }); + if (containerKey) { + key = containerKey.replace('__reactContainer$', '__reactProps$'); + reactBindingKeys.set(island, key); + } + } + if (key) { + bindingRootFound = true; + if (element !== island) bindingKey = key; + } + } island = island.parentElement && island.parentElement.closest('astro-island'); } + if (bindingKey && !Object.prototype.hasOwnProperty.call(element, bindingKey)) { + pendingBindings.add(element); + retryPendingBindings(); + return false; + } return true; } - function eligible(element, beforeHydration) { + function eligible(element) { if (!element || element.closest(excludedSelector)) return false; if (element.closest('main article') && !element.closest('button, .fern-page-actions')) return false; - return beforeHydration || isHydrated(element); + return isHydrated(element); } - function syncLabels(rootDocument, lang, beforeHydration, roots) { - var selected = beforeHydration ? (nativeDictionaries[lang] || nativeDictionaries[lang.split("-")[0]] || nativeDictionaries.en) : dictionary(lang); + // Preserve server-rendered labels until Fern hydrates each island. Its native + // renderer already uses the target locale; translating earlier causes #418. + function syncLabels(rootDocument, lang, roots) { + var selected = dictionary(lang); var processedRoots = new WeakSet(); (roots || rootDocument.querySelectorAll(uiSelector)).forEach(function (root) { - if (!beforeHydration && !roots && !observedRoots.has(root)) { + if (!roots && !observedRoots.has(root)) { observedRoots.add(root); uiObserver.observe(root, { childList:true, subtree:true, characterData:true, attributes:true, attributeFilter:['aria-label','title','placeholder','data-fern-hydrated'] }); } // Keep observing pending islands so they are synchronized when ready. - if (root.closest(excludedSelector) || (!beforeHydration && !isHydrated(root))) return; + if (root.closest(excludedSelector) || !isHydrated(root)) return; for (var parent = root.parentElement; parent; parent = parent.parentElement) { if (processedRoots.has(parent)) return; } @@ -75,24 +107,24 @@ var walker = rootDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, { acceptNode: function (node) { if (node.nodeType !== 1) return NodeFilter.FILTER_ACCEPT; - if (node.matches(excludedSelector) || (!beforeHydration && node.matches('astro-island:not([data-fern-hydrated])'))) { + if (node.matches(excludedSelector) || node.matches('astro-island:not([data-fern-hydrated])')) { return NodeFilter.FILTER_REJECT; } return NodeFilter.FILTER_SKIP; } }), node; while ((node = walker.nextNode())) { - if (!eligible(node.parentElement, beforeHydration)) continue; - var next = translate(node.nodeValue, selected, beforeHydration); + if (!eligible(node.parentElement)) continue; + var next = translate(node.nodeValue, selected); if (next !== node.nodeValue) node.nodeValue = next; } var elements = root.querySelectorAll('[aria-label], [title], [placeholder]'); function syncAttributes(element) { - if (!eligible(element, beforeHydration) || (beforeHydration && element.classList.contains('sixmm-theme-trigger'))) return; + if (!eligible(element)) return; translatedAttributes.forEach(function (name) { var value = element.getAttribute(name); if (value === null) return; - var next = translate(value, selected, beforeHydration); + var next = translate(value, selected); if (next !== value) element.setAttribute(name, next); }); } @@ -100,16 +132,6 @@ elements.forEach(syncAttributes); }); } - // Fern loads only the initial language dictionary into its module cache. - // Align incoming UI markup with the dictionary React can actually render, - // then localize hydrated controls. Preserve normal load/deferred/lazy modes. - window.__sixmmPrepareInterfaceSwap = function (incoming, targetLanguage) { - var initialBase = initialLanguage.split('-')[0]; - var targetBase = targetLanguage.split('-')[0]; - var nativeLanguages = ['de','el','es','fr','it','ja','ko','pl','pt','ru','tr','zh']; - var rendererLanguage = initialBase === targetBase && nativeLanguages.indexOf(initialBase) >= 0 ? initialBase : 'en'; - syncLabels(incoming, rendererLanguage, true); - }; function syncEditLinks(lang) { document.querySelectorAll('a[href^="https://github.com/6mm-com/docs/blob/main/fern/"]').forEach(function (link) { if (!isHydrated(link)) return; @@ -127,14 +149,14 @@ var changed = []; dirtyRoots.forEach(function (root) { if (root.isConnected) changed.push(root); }); dirtyRoots.clear(); - syncLabels(document, lang, false, changed); + syncLabels(document, lang, changed); return; } fullSyncRequested = false; dirtyRoots.clear(); uiObserver.disconnect(); observedRoots = new WeakSet(); - syncLabels(document, lang, false); + syncLabels(document, lang); syncEditLinks(lang); document.querySelectorAll('a[data-astro-prefetch="viewport"], a[data-astro-prefetch="load"]').forEach(function (link) { if (isHydrated(link)) link.setAttribute('data-astro-prefetch','hover'); @@ -148,7 +170,9 @@ function queueSync() { if (scheduled) return; scheduled = true; - window.requestAnimationFrame(sync); + // Fern's outer island effect can precede hydration of its Suspense content. + // Leave React's current render/paint turn before updating localized labels. + window.requestAnimationFrame(function () { window.setTimeout(sync, 0); }); } uiObserver = new MutationObserver(function (records) { records.forEach(function (record) { diff --git a/fern/language-modal.js b/fern/language-modal.js index efaa2409..a9587345 100644 --- a/fern/language-modal.js +++ b/fern/language-modal.js @@ -610,30 +610,6 @@ if (root.classList.contains("light")) return "light"; return root.dataset.theme === "dark" ? "dark" : "light"; } - function prepareLocaleSwap(event) { - if (!event.from || !event.to || !event.newDocument) return; - var routeLocale = function (url) { - var first = url.pathname.split("/").find(Boolean) || ""; - return locales.some(function (item) { return item.code && item.code === first; }) ? first : ""; - }; - if (typeof window.__sixmmPrepareInterfaceSwap === 'function') { - window.__sixmmPrepareInterfaceSwap(event.newDocument, routeLocale(event.to) || 'en'); - return; - } - if (routeLocale(event.from) === routeLocale(event.to)) return; - // A fast navigation before the interface bridge loads only remounts the - // small UI roots. Article/sidebar content keeps its original lazy strategy. - event.newDocument.querySelectorAll('astro-island[client]:not([client="only"])').forEach(function (island) { - var options; - try { options = JSON.parse(island.getAttribute("opts") || "{}"); } - catch (error) { return; } - if (!/^(HeaderContentIsland|PageHeaderIsland|TableOfContentsIsland|FooterIsland)$/.test(options.name)) return; - options.value = "react"; - island.setAttribute("opts", JSON.stringify(options)); - island.setAttribute("client", "only"); - }); - } - async function navigateDocsTheme(theme) { if (theme !== "light" && theme !== "dark") return false; if (currentTheme() === theme) return true; @@ -695,7 +671,6 @@ // locale immediately so standalone navigation tabs never flash on first paint. syncLocaleTabs(currentRoute()); document.addEventListener("DOMContentLoaded", scheduleSync); - document.addEventListener("astro:before-swap", prepareLocaleSwap); document.addEventListener("fern:island-hydrated", scheduleSync); document.addEventListener("astro:page-load", scheduleSync); window.addEventListener("pageshow", function () { diff --git a/scripts/check-docs-interface.mjs b/scripts/check-docs-interface.mjs index 0ae8fd83..0399d42b 100644 --- a/scripts/check-docs-interface.mjs +++ b/scripts/check-docs-interface.mjs @@ -4,6 +4,7 @@ import { runInNewContext } from "node:vm"; const script = await readFile(new URL("../fern/docs-interface.js", import.meta.url), "utf8"); const callbacks = []; +const tasks = []; const listeners = {}; let observerCount = 0; const observerCallbacks = []; @@ -39,6 +40,7 @@ const window = { location: { pathname: "/ar/prediction/overview" }, __sixmmDocsLocales: [{ code: "" }, { code: "ar" }, { code: "zh-CN" }, { code: "ja" }], requestAnimationFrame: (callback) => callbacks.push(callback), + setTimeout: (callback) => tasks.push(callback), addEventListener: (name, callback) => { listeners[name] = callback; }, }; const document = { @@ -61,7 +63,13 @@ const sandbox = { observe() {} disconnect() {} }, }; -function flush() { while (callbacks.length) callbacks.shift()(); } +function flushFrames() { while (callbacks.length) callbacks.shift()(); } +function flush() { + while (callbacks.length || tasks.length) { + flushFrames(); + while (tasks.length) tasks.shift()(); + } +} runInNewContext(script, sandbox); flush(); assert.equal(nodes[0].nodeValue, "Search", "Do not mutate text while React hydration is pending"); @@ -77,6 +85,9 @@ flush(); assert.equal(nodes[0].nodeValue, "Search", "A child island cannot alter markup while its parent layout is still hydrating"); layoutReady = true; listeners["fern:island-hydrated"](); +flushFrames(); +assert.equal(nodes[0].nodeValue, "Search", "An outer island effect must not rewrite labels in React's current render/paint turn"); +assert.equal(attributes.get("aria-label"), "Search", "Accessibility labels also wait for the post-render task"); flush(); assert.equal(nodes[0].nodeValue, "بحث"); assert.equal(nodes[1].nodeValue, "نسخ الصفحة"); @@ -101,18 +112,18 @@ assert.equal(nodes[2].nodeValue, 'Search', 'Article text is never translated by window.location.pathname = '/sdk/overview'; listeners['astro:page-load'](); flush(); assert.equal(nodes[0].nodeValue, 'Search', 'Returning to English must restore labels'); -window.__sixmmPrepareInterfaceSwap(document,'zh-CN'); -assert.equal(nodes[0].nodeValue,'Search','Unsupported initial UI languages normalize to Fern native English before hydration'); -assert.equal(nodes[4].nodeValue,'Edit this page','Normalize the GitHub edit label before lazy footer hydration'); -nodes[4].nodeValue='在仪表板中编辑'; -window.__sixmmPrepareInterfaceSwap(document,'zh-CN'); -assert.equal(nodes[4].nodeValue,'Edit this page','Both native edit label variants share the English key'); +for (const label of ['编辑此页面', '在仪表板中编辑']) { + nodes[4].nodeValue = label; + window.location.pathname = '/sdk/overview'; + listeners['astro:page-load'](); flush(); + assert.equal(nodes[4].nodeValue, 'Edit this page', 'Both edit label variants remain localized after hydration'); +} nodes.push({ nodeValue: 'Light', parentElement: { closest: hydratedAncestor } }); window.__sixmmDocsLocales.push({ code: 'de' }, { code: 'id' }, { code: 'uk' }, { code: 'vi' }); window.location.pathname = '/de/sdk/overview'; listeners['astro:page-load'](); flush(); assert.equal(nodes.at(-1).nodeValue, 'Hell', 'Hydrated theme controls use the selected locale'); -window.__sixmmPrepareInterfaceSwap(document, 'de'); -assert.equal(nodes.at(-1).nodeValue, 'Light', 'Added theme translations must normalize back to native markup before hydration'); +window.location.pathname = '/sdk/overview'; listeners['astro:page-load'](); flush(); +assert.equal(nodes.at(-1).nodeValue, 'Light', 'Returning to English restores hydrated theme labels'); for (const [lang, expected] of [['id', 'Asisten'], ['uk', 'Помічник'], ['vi', 'Trợ lý']]) { nodes[1].nodeValue = 'Assistant'; window.location.pathname = '/' + lang + '/sdk/overview'; listeners['astro:page-load'](); flush(); diff --git a/scripts/check-widget-sync.mjs b/scripts/check-widget-sync.mjs index 9c22dae8..5245110c 100644 --- a/scripts/check-widget-sync.mjs +++ b/scripts/check-widget-sync.mjs @@ -784,29 +784,25 @@ const incomingIsland = { setAttribute: (name, value) => incomingIslandAttributes.set(name, value), }; function prepareIncomingLocale(from, to) { - adapterDocumentListeners["astro:before-swap"]({ + adapterDocumentListeners["astro:before-swap"]?.({ from: new URL(from, adapterWindow.location.origin), to: new URL(to, adapterWindow.location.origin), newDocument: { querySelectorAll: () => [incomingIsland] }, }); } -prepareIncomingLocale("/zh-CN/sdk/overview", "/zh-CN/trading/overview"); -assert.equal(incomingIslandAttributes.get("client"), "load", "Ordinary page navigation must keep normal SSR hydration"); -prepareIncomingLocale("/sdk/overview", "/zh-CN/sdk/overview"); -assert.equal(incomingIslandAttributes.get("client"), "only", "Cross-locale navigation must not hydrate against stale-locale state"); -assert.equal(JSON.parse(incomingIslandAttributes.get("opts")).value, "react"); -assert.equal(incomingIsland.innerHTML, "Localized article content", "Locale remounting must preserve article slots"); -incomingIslandAttributes.set("client", "load"); -incomingIslandAttributes.set("opts", JSON.stringify({ name: "PageHeaderIsland", value: true })); -prepareIncomingLocale("/zh-CN/sdk/overview", "/zh-CN/developer-api/overview"); -assert.equal(incomingIslandAttributes.get("client"), "load", "Ordinary navigation keeps the original loading strategy"); -assert.equal(incomingIsland.innerHTML, "Localized article content", "Subsequent navigation must preserve article slots"); -let bridgeCalls=0; -adapterWindow.__sixmmPrepareInterfaceSwap=()=>{bridgeCalls++;}; -incomingIslandAttributes.set('client','lazy'); -prepareIncomingLocale('/sdk/overview','/zh-CN/sdk/overview'); -assert.equal(incomingIslandAttributes.get('client'),'lazy','A ready interface bridge preserves deferred and lazy hydration'); -assert.equal(bridgeCalls,1); +for (const strategy of ['load', 'idle', 'visible', 'lazy', 'only']) { + incomingIslandAttributes.set('client', strategy); + const before = [...incomingIslandAttributes]; + for (const [from, to] of [ + ['/zh-CN/sdk/overview', '/zh-CN/trading/overview'], + ['/sdk/overview', '/zh-CN/sdk/overview'], + ['/zh-CN/sdk/overview', '/ja/sdk/overview'], + ]) { + prepareIncomingLocale(from, to); + assert.deepEqual([...incomingIslandAttributes], before, 'Navigation must preserve Fern SSR hydration options'); + assert.equal(incomingIsland.innerHTML, 'Localized article content', 'Navigation must preserve incoming content'); + } +} assert.equal( adapterRoot.dataset.sixmmDocsLocale, "en", diff --git a/tests/browser/regression.test.mjs b/tests/browser/regression.test.mjs index ad47534f..e961b51f 100644 --- a/tests/browser/regression.test.mjs +++ b/tests/browser/regression.test.mjs @@ -134,6 +134,42 @@ for (const [name, engine] of Object.entries({ chromium, webkit })) { }); }); + await t.test('locale swaps preserve incoming SSR labels and hydration strategies at every loading phase', async () => { + const page = await browser.newPage(); + const errors = []; + page.on('pageerror', error => errors.push(error.message)); + try { + await page.route('**/*', route => route.fulfill({ contentType: 'text/html', body: '' })); + await page.goto(origin); + for (const script of ['language-modal.js', 'docs-interface.js']) { + await page.addScriptTag({ content: await readFile(new URL('../../fern/' + script, import.meta.url), 'utf8') }); + const results = await page.evaluate(locales => { + return locales.flatMap(locale => { + const target = locale.default ? '' : '/' + locale.code; + return [target, '', '/ja', '/ar'].map(source => { + const incoming = new DOMParser().parseFromString('', 'text/html'); + incoming.documentElement.lang = locale.code; + incoming.body.innerHTML = ['load', 'idle', 'visible', 'lazy', 'only'].map((strategy, index) => + ` +
+
+

${locale.label}

Localized content +
`).join(''); + const before = incoming.documentElement.outerHTML; + const event = new Event('astro:before-swap'); + Object.assign(event, { from: new URL(source + '/guide', location.origin), to: new URL(target + '/guide', location.origin), newDocument: incoming }); + document.dispatchEvent(event); + return { locale: locale.code, source, preserved: incoming.documentElement.outerHTML === before }; + }); + }); + }, locales); + assert.equal(results.length, locales.length * 4); + assert.deepEqual(results.filter(result => !result.preserved), [], `${script}: incoming text, attributes and loading strategies must survive until native hydration`); + } + assert.deepEqual(errors, []); + } finally { await page.close(); } + }); + await t.test('nested hydration and excluded content preserve server text', async () => { const markup = `
${'Search'.repeat(100)}
@@ -168,6 +204,34 @@ for (const [name, engine] of Object.entries({ chromium, webkit })) { }); }); + await t.test('outer readiness does not translate React content before deferred host bindings attach', async () => { + await withPage(browser, { pathname: '/uk/guide' }, async page => { + await page.evaluate(() => { + const island = document.createElement('astro-island'); + island.setAttribute('data-fern-hydrated', ''); + island.__reactContainer$fixture = {}; + island.setAttribute('component-url', '/FooterIsland.fixture.js'); + island.innerHTML = '
'; + island.firstElementChild.__reactProps$fixture = {}; + const outer = document.createElement('astro-island'); + outer.setAttribute('data-fern-hydrated', ''); + outer.__reactContainer$outer = {}; + outer.appendChild(island); + document.body.appendChild(outer); + document.dispatchEvent(new Event('fern:island-hydrated')); + }); + await page.waitForTimeout(120); + const label = page.locator('#deferred-label'); + assert.equal(await label.textContent(), 'Search'); + assert.equal(await label.getAttribute('aria-label'), 'Search'); + // React attaches host bindings without changing matching server markup. + await label.evaluate(node => { node.__reactProps$fixture = {}; }); + await page.waitForFunction(() => document.getElementById('deferred-label').textContent === 'Пошук'); + assert.equal(await label.getAttribute('aria-label'), 'Пошук'); + await label.evaluate(node => node.closest('astro-island').remove()); + }); + }); + await t.test('late cards retain their existing effects after body replacements', async () => { await withPage(browser, {}, async page => { for (let swap = 0; swap < 2; swap++) {