I wanted to do the same. In Symfony 1.4, this is what I did:
Created a domain map => culture in app.yml
all: languages: domain_map: www.example.com: en www.example.it: it www.example.es: es
The myPatternRouting class has been myPatternRouting that extends sfPatternRouting
class myPatternRouting extends sfPatternRouting { public function getConfigFileName() { $domain_map = sfConfig::get('app_languages_domain_map'); $domain = $_SERVER['SERVER_NAME']; $culture = isset($domain_map[$domain]) ? $domain_map[$domain] : 'en'; $routing = sprintf('config/routing.%s.yml', $culture); return sfContext::getInstance()->getConfigCache()->checkConfig($routing, true); } }
Changed factory for routing in factories.yml
all: routing: class: myPatternRouting
Created a configuration handler entry for the new routing.yml file template in config_handlers.yml
config/routing.*.yml: class: sfRoutingConfigHandler
And then create the routing files as routing.[culture].yml
And it works :)
source share