intlify / intlify/utils

feature request getPathWithoutLocale

Open
#30 3 comments 0 reactions 0 assignees View on GitHub
feature status: proposal
Dominant language
TypeScript
Stars
17
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### Clear and concise description of the problem

need write regexp
like this `\/\S{0,2}\/?landings\/?(.+)?` - is simple `en`/`fr` (but is `en_US`?)

```
http://localhost:3010/davos
http://localhost:3010/landings/davos
http://localhost:3010/landings
http://localhost:3010/landings/
http://localhost:3010/fr/landings/davos
http://localhost:3010/fr/landings
http://localhost:3010/fr/landings/
```

### Suggested solution

it would be convenient to parse h3 routers on the server for example function: `getPathWithoutLocale`

```
http://localhost:3010/fr/landings -> /landings
http://localhost:3010/en_US/landings -> /landings
```

### Alternative

_No response_

### Additional context

_No response_

### Validations

- [X] Follow our [Code of Conduct](https://github.com/intlify/.github/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guide](https://github.com/intlify/utils/blob/main/CONTRIBUTING.md).
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.