php - Symfony internationalization -


i having strange problem translation in symfony 2.

this config.yml

imports:     - { resource: parameters.yml }     - { resource: security.yml }     - { resource: services.yml }  # put parameters here don't need change on each machine app deployed # http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration  framework:     #esi:             ~     translator: { fallbacks: ['%locale%'] }     secret:          "%secret%"     router:         resource: "%kernel.root_dir%/config/routing.yml"         strict_requirements: ~     form:            ~     csrf_protection: ~     validation:      { enable_annotations: true }     #serializer:      { enable_annotations: true }     templating:         engines: ['twig']         #assets_version: someversionscheme     trusted_hosts:   ~     trusted_proxies: ~     session:         # handler_id set null use default session handler php.ini         handler_id:  ~     fragments:       ~     http_method_override: true  # twig configuration twig:     debug:            "%kernel.debug%"     strict_variables: "%kernel.debug%"  # assetic configuration assetic:     debug:          "%kernel.debug%"     use_controller: false     bundles:        [ ]     #java: /usr/bin/java     filters:         cssrewrite: ~         #closure:         #    jar: "%kernel.root_dir%/resources/java/compiler.jar"         #yui_css:         #    jar: "%kernel.root_dir%/resources/java/yuicompressor-2.4.7.jar"  # doctrine configuration doctrine:     dbal:         driver:   pdo_mysql         host:     "%database_host%"         port:     "%database_port%"         dbname:   "%database_name%"         user:     "%database_user%"         password: "%database_password%"         charset:  utf8         mapping_types:           enum: string         # if using pdo_sqlite database driver:         #   1. add path in parameters.yml         #     e.g. database_path: "%kernel.root_dir%/data/data.db3"         #   2. uncomment database_path in parameters.yml.dist         #   3. uncomment next line:         #     path:     "%database_path%"      orm:         auto_generate_proxy_classes: "%kernel.debug%"         naming_strategy: doctrine.orm.naming_strategy.underscore         auto_mapping: true  # swiftmailer configuration swiftmailer:     transport: "%mailer_transport%"     host:      "%mailer_host%"     username:  "%mailer_user%"     password:  "%mailer_password%"     spool:     { type: memory }  fos_user:     db_driver: orm     firewall_name: main     user_class: appbundle\entity\user     profile:         form:             type: app_user_profile 

parameters.yml

... locale: ru 

and, of course, have messages.en.yml , messages.ru.yml.

even when locale set 'ru' displays english text, , $request->getlocale() returning 'en'.

what problem , overset 'en' if not in configs?

the locale parameter in config.yml file fallback in case translation requested language not available.

calling $request->getlocale() return language configuration of browser http-request sent.

if want translation forced language take @ answer: https://stackoverflow.com/a/14331838/1173391


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -