2017 © Pedro Peláez
 

symfony-bundle multilingual-routing-bundle

Simple example of multilingual routing and translating

image

inwaar/multilingual-routing-bundle

Simple example of multilingual routing and translating

  • Monday, April 24, 2017
  • by inwaar
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

MultilingualRoutingBundle Build Status

Multilingual Routing Bundle for the Symfony Framework, (*1)

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*2)

$ composer require inwaar/multilingual-routing-bundle:dev-master

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*3)

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*4)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new MultilingualRoutingBundle\MultilingualRoutingBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Configure the Bundle

# app/config/config.yml

multilingual_routing:
    map:
      en: com
      en_GB: co.uk

The map is optional., (*5)

Add type: localized to the route definition, so the root route (/) will be appended by {_locale}., (*6)

# app/config/routing.yml
app:
      resource: "@AppBundle/Resources/config/routing.yml"
      prefix: /
      type: localized

Or, (*7)

# app/config/config.yml
framework:
    router:
        type: localized
        resource: '%kernel.root_dir%/routing.yml'

Or configure the route manually., (*8)

Usage

Make sure all domains point to the host you run the app. Or add a list to your local host config., (*9)

# /etc/host

127.0.0.1 example.com
127.0.0.1 example.nl
127.0.0.1 example.fr
127.0.0.1 example.us
127.0.0.1 example.co.uk

Example application

https://github.com/inwaar/multilingual-routing-example, (*10)

The Versions

24/04 2017

dev-master

9999999-dev

Simple example of multilingual routing and translating

  Sources   Download

MIT

The Requires

 

The Development Requires

by Igor Staroverov