@uniweb/kit 0.4.6 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/kit",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "Standard component library for Uniweb foundations",
5
5
  "type": "module",
6
6
  "exports": {
@@ -39,7 +39,7 @@
39
39
  "fuse.js": "^7.0.0",
40
40
  "shiki": "^3.0.0",
41
41
  "tailwind-merge": "^2.6.0",
42
- "@uniweb/core": "0.3.6"
42
+ "@uniweb/core": "0.3.8"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": "^18.0.0 || ^19.0.0",
@@ -164,7 +164,7 @@ export function Link({
164
164
  children,
165
165
  ...props
166
166
  }) {
167
- const { localize, makeHref, getRoutingComponents } = useWebsite()
167
+ const { website, localize, makeHref, getRoutingComponents } = useWebsite()
168
168
  const RouterLink = getRoutingComponents()?.Link
169
169
 
170
170
  // Normalize href
@@ -177,6 +177,24 @@ export function Link({
177
177
  linkHref = makeHref(linkHref)
178
178
  }
179
179
 
180
+ // Add locale prefix for internal links in non-default locales
181
+ if (linkHref.startsWith('/') && !isExternalUrl(linkHref)) {
182
+ if (website?.hasMultipleLocales?.()) {
183
+ const activeLocale = website.getActiveLocale()
184
+ const defaultLocale = website.getDefaultLocale()
185
+ if (activeLocale && activeLocale !== defaultLocale) {
186
+ // Translate route slug for current locale (e.g., /about → /acerca-de)
187
+ if (website.translateRoute) {
188
+ linkHref = website.translateRoute(linkHref, activeLocale)
189
+ }
190
+ const prefix = `/${activeLocale}`
191
+ if (!linkHref.startsWith(`${prefix}/`) && linkHref !== prefix) {
192
+ linkHref = linkHref === '/' ? `${prefix}/` : `${prefix}${linkHref}`
193
+ }
194
+ }
195
+ }
196
+ }
197
+
180
198
  // Auto-generate title if not provided
181
199
  const linkTitle = title || generateTitle(linkHref, localize)
182
200