Skip to content

getRelativeLocaleUrl doesn't work correctly with trailingSlash: 'never' #11630

Description

@Vipermaseg

Astro Info

Astro                    v4.13.1
Node                     v18.20.3
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

My header has a logo that is supposed to go to my index: htt-p://mysite.com, and when I am in Portuguese I should get the link htt-p://mysite.com/pt

Using getRelativeLocaleUrl(locale, "/") will yield:
locale = en -> htt-p://mysite.com
locale = es -> htt-p://mysite.com/es/

Using getRelativeLocaleUrl(locale) will yield:
locale = en -> htt-p://mysite.com/example
locale = es -> htt-p://mysite.com/es

Where "example" could be any page I am currently at.

What's the expected result?

Using getRelativeLocaleUrl(locale, "/") should yield:
locale = en -> htt-p://mysite.com
locale = es -> htt-p://mysite.com/es

Using getRelativeLocaleUrl(locale) should yield:
locale = en -> htt-p://mysite.com
locale = es -> htt-p://mysite.com/es

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-weczql?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P3: minor bugAn edge case that only affects very specific usage (priority)feat: i18nRelated to internalization (scope)

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions