Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6857469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:01:24+00:00 2026-05-27T02:01:24+00:00

how to create multilanguage page in Symfony? In Symfony 1.0, Jobeet tutorial has very

  • 0

how to create multilanguage page in Symfony? In Symfony 1.0, Jobeet tutorial has very good description. But now on symfony.com, i haven’t seen somethings related to translation of page.
In symfony 1.4, echo __(‘text’); is used, but now in Symfony 2 TWIG is used.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:01:25+00:00Added an answer on May 27, 2026 at 2:01 am

    There is a documentation section on this on the Symfony2 website.

    You can check it here: Translations

    Basically, you have access in the routing to a special attribute named _locale that is put in your url and will be used to set the locale in the session. Note that using this scheme, the locale value is automatically set into the Session by Symfony2

    http://www.host.com/en/contact // English version
    http://www.host.com/fr/contact // French version
    

    You can also specify a default _locale value in your routes so it is not mandatory to provide the locale in the url.

    http://www.host.com/contact    // English version if default _locale is 'en'
    

    Then, in twig, you use the special transformer trans and transchoice to translate messages. Your messages can be a key or an natural language message that is used as the key, usually in english.

    {{ 'user.prompt.welcome' | trans }} {# Key message #}
    {{ 'Welcome to our site' | trans }} {# Natural language message #}
    

    The locale to translate the message is taken from the session, so changing the locale in the session (via the url or programmaticaly), will change the translation to another thing.

    This uses the translator service under the hood.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to create a multilanguage website.I used this http://www.phpsimplicity.com/tips.php?id=15 tutorial and it works
Possible Duplicates: Create a webpage with Multilanguage in PHP PHP - how to translate
There are plenty of tutorials how to create multilanguage RESX files and how to
Which is the best way to have a multilanguage app? Should I create a
Symfony 1.4 Propel (with sfPropel15Plugin) I have a multilanguage Gallery with the following schema:
is it possible to create a multilanguage installer using WIX ?
I want to use utf 8 right now , but all my data is
What is the best way to create multi-language database? To create localized table for
create table person ( name varchar(15), attr1 varchar(15), attr2 varchar(1), attr3 char(1), attr4 int
Create a flat text file in c++ around 50 - 100 MB with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.