sfLanguageSwitchPlugin - 0.0.1

Language switcher for symfony

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source | Show as Markdown

sfLanguageSwitch plugin

The sfLanguageSwitchPlugin is a symfony plugin that provides a simple language switcher generator. The available languages depends on the settings from app.yml.

You have to call a simple component only and it will result in the switch.

Installation

  • Install the plugin

      symfony plugin-install http://plugins.symfony-project.com/sfLanguageSwitch
    
  • Enable the module in your settings.yml

      all:
        .settings:
          enabled_modules: [sfLanguageSwitch](default,)
    
  • Clear you cache

      symfony cc
    
  • Add the available languages and settings to app.yml

      sfLanguageSwitch:
        flagPath:  /sfLanguageSwitch/images/flag
        availableLanguages:
          de:
            title: Deutsch
          en:
            title: English
            image: /sfLanguageSwitch/images/flag/us.png
    
  • Change your routing on routing.yml

      homepage:
        url:   /
        param: { sf_culture: de, module: home, action: index }
    
      default_index:
        url:   /:sf_culture/:module
        requirements: { sf_culture: (?:en|de) }
        param: { action: index }
    
      default:
        url:   /:sf_culture/:module/:action/*
        requirements: { sf_culture: (?:en|de) }
    

Customize sfLanguageSwitch module templates

By default, sfLanguageSwitch module comes with 1 very simple template:

  • _get.php

If you want to customize this template:

  • Create a sfLanguageSwitch module in your application (don't use the init-module task, just create a sfLanguageSwitch directory)

  • Create a template with the name of the template you want to customize in the sfLanguageSwitch/templates directory

  • symfony now renders your template instead of the default one

TODO

  • make it more flexible

Changelog

0.0.1

  • mosez: initial release