Let’s suppose you have a data model wich you want to internationalize. Just to put something on the table, cities (let’s take it easy). The name of city will vary according to the language, so London is the english name, but Londres is the spanish one.

According to this, the schema.yml file will look like this:

City:
  actAs:
    I18n: { fields: [name] }
  columns:
    name: { type: string(255) }

Something that I found quite hard to find in the Doctrine and Symfony doc was the way to build the fixtures.yml for such a model. Here is the solution (quite easy, anyway) :

City:
  city_01:
    # here the non-I18n data fields
    Translation:
      en: { name: "London" }
      es: { name: "Londres" }

Compártelo:
  • Print this article!
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Ping.fm
  • RSS
  • Twitter