Skip to content

Localized urls for multilanguage website (same as mcamara / laravel-localization) #3460

@ElyesaErgezen

Description

@ElyesaErgezen

Is there a way or a package that we can use for localized urls in AdonisJS v4.1 just like in Laravel?

Example of prefixing language:
instead of

Route.get('/', 'IndexController.index') -> Dutch
Route.get('/en', 'IndexController.index') -> English
Route.get('/fr', 'IndexController.index') -> French

this

Route.group(() => {
    Route.get('/', 'IndexController.index')
}).prefix(LANG-PREFIX)

Laravel

Route::group(['prefix' => LaravelLocalization::setLocale()], function(){
    Route::get('/', 'IndexController@index');
});

Example of translated url:

Route.get('/artikelen', 'IndexController.index') -> Dutch
Route.get('/en/articles', 'IndexController.index') -> English
Route.get('/fr/des-articles', 'IndexController.index') -> French

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions