This commit is contained in:
babayaga 2025-08-21 14:49:19 +02:00
parent 38823d946f
commit 56af819c28
6 changed files with 12 additions and 8 deletions

View File

@ -8,9 +8,9 @@ export const OSR_ROOT = () => path.resolve(resolve("${OSR_ROOT}"))
export const LOGGING_NAMESPACE = 'polymech-site'
export const TRANSLATE_CONTENT = true
export const LANGUAGES = ['en', 'ar', 'de', 'ja', 'es', 'zh']
export const LANGUAGES = ['en', 'de', 'es', 'fr']
//export const LANGUAGES_PROD = ['en']
export const LANGUAGES_PROD = ['en', 'es', 'ar', 'de', 'ja', 'zh', 'fr']
export const LANGUAGES_PROD = ['en', 'es', 'de','fr']
export const isRTL = (lang) => lang === 'ar'
// i18n constants

View File

@ -26,7 +26,7 @@ export const translate = async (text: string, srcLanguage = 'en', targetLanguage
})
return translation
} catch (e) {
logger.error(`Failed to translate text: ${text} from ${srcLanguage} to ${targetLanguage} : ${e.message}`, e)
logger.error(`Failed to translate text: ${text} from ${srcLanguage} to ${targetLanguage} : ${e.message}`)
}
return text
}
@ -57,10 +57,9 @@ export const translateSheets = async (product, language) => {
if (I18N_CACHE && exists(dst)) {
return dst
}
logger.debug(`Translate assets ${src} to ${language}`)
try {
return await translateXLS(path.resolve(src), dst, i18nOptions)
} catch (e) {
logger.error(`Failed to translate assets ${src} to ${language}`, e.message, e)
logger.error(`Failed to translate assets ${src} to ${language}`, e.message)
}
}

View File

@ -4,7 +4,6 @@ import TableOfContentsWithScroll from './TableOfContentsWithScroll.astro';
import { processSidebarGroup, getCurrentPath } from './utils';
import type { SidebarGroup as SidebarGroupType } from './types';
import type { MarkdownHeading } from 'astro';
import Translate from "@polymech/astro-base/components/i18n.astro";
import SidebarPersister from './SidebarPersister.astro';
import { I18N_SOURCE_LANGUAGE } from "config/config.js";

View File

@ -4,6 +4,7 @@ import { generateToC } from './utils/generateToC.js';
import TableOfContentsList from './TableOfContents/TableOfContentsList.astro';
import Translate from "@polymech/astro-base/components/i18n.astro";
// @todo: scroll observer
interface Props {
headings: MarkdownHeading[];
title?: string;
@ -38,6 +39,9 @@ const toc = generateToC(headings, {
)}
<script>
// DISABLED: Auto-scrolling TOC functionality to prevent intersection observer jitters
// The TOC is still visible and functional, but won't auto-scroll or highlight active sections
/*
class TableOfContentsScroll {
private observer: IntersectionObserver;
private tocLinks: NodeListOf<HTMLAnchorElement>;
@ -145,6 +149,7 @@ const toc = generateToC(headings, {
document.addEventListener('astro:before-preparation', () => {
tocScroll?.destroy();
});
*/
</script>
<style>
@ -210,6 +215,7 @@ const toc = generateToC(headings, {
background-color: #f3f4f6; /* bg-gray-100 */
}
/* Note: Active state styling is disabled since auto-scrolling is disabled */
:global(.toc-nav a[aria-current="true"]),
:global(.toc-nav a.active) {
color: #1d4ed8; /* text-blue-700 */

View File

@ -182,7 +182,7 @@ function buildSidebarFromStructure(
sortBy: SortFunction = 'alphabetical',
customSort?: (a: SidebarLink | SidebarGroup, b: SidebarLink | SidebarGroup) => number,
entries?: any[],
locale: string
locale?: string
): (SidebarLink | SidebarGroup)[] {
const items: (SidebarLink | SidebarGroup)[] = [];
// Process root level files first

View File

@ -90,7 +90,7 @@ export function resolveImagePath(src: string, entryPath?: string, astroUrl?: URL
// Parent Directory Check: If not found, check one level
if (enableDebugErrors) console.warn(`[resolveImagePath] [WARN-${strategy}] Not found in "${basePath}". Checking parent directory.`);
// if (enableDebugErrors) console.warn(`[resolveImagePath] [WARN-${strategy}] Not found in "${basePath}". Checking parent directory.`);
const parentBasePath = path.resolve(basePath, '..');
resolvedPath = checkFilePath(parentBasePath, src);
if (resolvedPath) {