Return to site
· Multilingual routes,Laravel,Web Development
broken image

When you are developing a multilingual website you need to create multilingual translated routes depending on selected languages. A little guidance for that is given below.

Their is a lang folder in your app directory, create the translations for your route here. Create route.php files depending  on the number languages you want  each must be in different language directory.

Example: If you want polish, french, english as languages.

For Polish:

// app/lang/pl/routes.php

return array(

    'contact' => 'kontakt',

    'about'   => 'o-nas'

);

For English:

// app/lang/en/routes.php

return array(

    'contact' => 'contact',

    'about'   => 'about-us'

);

For French:

// app/lang/fr/routes.php

return array(

    'contact' => 'contact-fr',

    'about'   => 'about-fr'

);

After the routes for all languages has been created go to app/config/app.php and find the line:

change it to the primary language and add the below code too.Read more