/apps/APPNAME/config/settings.yml
all: .settings: i18n: on
/apps/APPNAME/config/i18n.yml
default: default_culture: ja_JP
これで、ユーザのデフォルトのcultureがjaになるので、i18nヘルパーなどに反映される。
viewで使用する例:
/apps/APPNAME/config/view.yml
default: http_metas: content-type: text/html metas: title: myproject robots: index, follow description: myproject keywords: myproject language: "<?php $lang = explode('_', sfContext::getInstance()->getUser()->getCulture()); echo $lang[0] ?>" stylesheets: [main] javascripts: [ ] has_layout: on layout: layout
/apps/APPNAME/templates/layout.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $lang = explode('_', $sf_user->getCulture()); echo $lang[0] ?>" lang="<?php echo $lang[0] ?>"> <head>