Skip to content

Route rewrite & localizated routes #3811

@maurictg

Description

@maurictg

Hello,

I do really like Fresh!

However, I am missing some control on the routing.
For instance, I would like to make a framework for localized routing (for instance: /mon-nom/maurice (FR -> french page) and /my-name/maurice (EN -> english page).

To make such a system possible, I need to be able to rewrite a request before it passes through the file based routing. Then I could for instance set the language on the ctx.state object and rewrite the URL/route to the folder structure (which will be English always).

This way, localization is easier. This is also how frameworks like Paraglide are working with localized routes.

Is this possible, if not, could it be made possible?
Would be great!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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