This commit is contained in:
lovebird 2026-02-04 18:05:21 +01:00
parent ef188fc427
commit a99c66e825
7 changed files with 1510 additions and 12 deletions

View File

@ -27,7 +27,7 @@ export async function getImageDetails(path, width, height, aspect) {
}
const { image, metadata } = await applyTransforms(
generateTransforms({ width, height }, builtins).transforms,
generateTransforms({ width, height }, builtins, new URLSearchParams()).transforms,
loadedImage
);

View File

@ -1,12 +1,12 @@
export default {
"environment": "dev",
"environment": "build",
"isSsrBuild": false,
"projectBase": "",
"publicDir": "C:\\Users\\zx\\Desktop\\polymech\\site2\\public\\",
"rootDir": "C:\\Users\\zx\\Desktop\\polymech\\site2\\",
"mode": "dev",
"outDir": "dist",
"assetsDir": "/_astro",
"mode": "production",
"outDir": "C:\\Users\\zx\\Desktop\\polymech\\site2\\dist\\",
"assetsDir": "_astro",
"sourcemap": false,
"assetFileNames": "/_astro/[name]@[width].[hash][extname]"
}

View File

@ -22,7 +22,7 @@ export const LANGUAGES_PROD = config.core.languages_prod
export const isRTL = (lang) => config.core.rtl_languages.includes(lang)
// i18n constants
export const I18N_STORE = (root, lang) => template(config.i18n.store, { root, lang, LANG: lang, OSR_ROOT: root })
export const I18N_STORE = (root, lang) => template("${root}/i18n-store/store-${LANG}.json", { root, lang, LANG: lang, OSR_ROOT: root })
export const I18N_CACHE = config.i18n.cache
export const I18N_ASSET_PATH = config.i18n.asset_path

View File

@ -25,7 +25,8 @@ export const translate = async (text: string, srcLanguage = 'en', targetLanguage
return text
}
try {
const store = I18N_STORE(OSR_ROOT(), targetLanguage)
const root = OSR_ROOT()
const store = I18N_STORE(root, targetLanguage)
let translation = text
translation = await translateText(text, srcLanguage, targetLanguage, {
store,
@ -38,6 +39,7 @@ export const translate = async (text: string, srcLanguage = 'en', targetLanguage
return text
}
export const translateSheets = async (product, language) => {
const pm_config: any = CONFIG_DEFAULT()
const config = loadConfig()
if (language === config.i18n.source_language) {

View File

@ -12,14 +12,11 @@ import { resolve } from '@polymech/commons'
import { get } from '@polymech/commons/component'
import { PFilterValid } from '@polymech/commons/filter'
import { IAssemblyData } from '@polymech/cad'
import { logger as log } from '../base/index.js'
import { translate } from "../base/i18n.js"
import { slugify } from '../base/strings.js'
import { loadConfig } from '../app/config-loader.js'
import { filesEx, forward_slash, resolveConfig, template } from '@polymech/commons'
import { ICADNodeSchema, IComponentConfig } from '@polymech/commons/component'
import type { Loader, LoaderContext } from 'astro/loaders'
@ -27,8 +24,6 @@ import type { Loader, LoaderContext } from 'astro/loaders'
import { PolymechInstance } from '../registry.js';
import { AppConfig } from "../app/config.schema.js"
import { logger } from '../app/logger.js'
const config = (): AppConfig => PolymechInstance.getConfig();
// Config Accessors

File diff suppressed because it is too large Load Diff

View File

@ -98,3 +98,58 @@ export const get = async (node: IComponentNode, component: IComponentConfig, opt
return jsonLD
}
/**
<html>
<head>
<title>Executive Anvil</title>
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Executive Anvil",
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
"description": "Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.",
"sku": "0446310786",
"mpn": "925872",
"brand": {
"@type": "Brand",
"name": "ACME"
},
"review": {
"@type": "Review",
"reviewRating": {
"@type": "Rating",
"ratingValue": 4,
"bestRating": 5
},
"author": {
"@type": "Person",
"name": "Fred Benson"
}
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": 4.4,
"reviewCount": 89
},
"offers": {
"@type": "AggregateOffer",
"offerCount": 5,
"lowPrice": 119.99,
"highPrice": 199.99,
"priceCurrency": "USD"
}
}
</script>
</head>
<body>
</body>
</html>
*/