feat(notes): liens internes, onglet Réseau, living blocks et consentement IA
Rend les liens entre notes visibles et persistants (sync NoteLink au save, auto-save, graphe réseau rafraîchi), ajoute living blocks, Memory Echo, recherche globale, consentement IA explicite et consolide les prototypes design en architectural-grid. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -58,25 +58,24 @@ export function LanguageProvider({ children, initialLanguage = 'en', initialTran
|
||||
}
|
||||
}, [initialLanguage])
|
||||
|
||||
// Load translations when language changes (with caching)
|
||||
// On first render, skip updateDocumentDirection since the inline script already set it.
|
||||
// Always reload locale JSON on the client so new i18n keys are picked up
|
||||
// (SSR initialTranslations may be stale until the next deploy).
|
||||
useEffect(() => {
|
||||
const cached = cacheRef.current.get(language)
|
||||
if (cached) {
|
||||
setTranslations(cached)
|
||||
if (!isFirstRender.current) updateDocumentDirection(language)
|
||||
isFirstRender.current = false
|
||||
return
|
||||
}
|
||||
let cancelled = false
|
||||
|
||||
const loadLang = async () => {
|
||||
const loaded = await loadTranslations(language)
|
||||
if (cancelled) return
|
||||
cacheRef.current.set(language, loaded)
|
||||
setTranslations(loaded)
|
||||
if (!isFirstRender.current) updateDocumentDirection(language)
|
||||
isFirstRender.current = false
|
||||
}
|
||||
|
||||
loadLang()
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [language])
|
||||
|
||||
const setLanguage = useCallback((lang: SupportedLanguage) => {
|
||||
@@ -90,8 +89,10 @@ export function LanguageProvider({ children, initialLanguage = 'en', initialTran
|
||||
if (!translations) return key
|
||||
|
||||
let value: any = getTranslationValue(translations, key)
|
||||
if (value === key && language !== 'en') {
|
||||
value = getTranslationValue(enTranslations as unknown as Translations, key)
|
||||
}
|
||||
|
||||
// Replace parameters like {count}, {percentage}, etc.
|
||||
if (params && typeof value === 'string') {
|
||||
Object.entries(params).forEach(([param, paramValue]) => {
|
||||
value = value.replace(`{${param}}`, String(paramValue))
|
||||
@@ -99,7 +100,7 @@ export function LanguageProvider({ children, initialLanguage = 'en', initialTran
|
||||
}
|
||||
|
||||
return typeof value === 'string' ? value : key
|
||||
}, [translations])
|
||||
}, [translations, language])
|
||||
|
||||
const value = useMemo(() => ({ language, setLanguage, t, translations }), [language, setLanguage, t, translations])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user