views:

27

answers:

2

Hi there, as you are aware, application strings change quite often. What I have done to solve this is I'm using a 'unique key' in my view, and then providing translations via a XLIFF file.

Default culture is en_US, other supported cultures include hi_IN I have 'en' & 'hi' folders with messages.xml in my 'app/I18n'

A string in the view looks like __('en str')

same is available in the en XLIFF as

<file source-language="EN" target-language="en" datatype="plaintext" original="messages" date="2010-08-09T09:35:50Z" product-name="messages">
  ....
<trans-unit id="xx">
  <source>en str</source>
  <target>string in english</target>
</trans-unit>

However, this does not work for the default culture / source-language, which is en This works fine for Hindi.

  1. Any clues? Are we not allowed to translate from Source to Source language?

  2. Also when an untranslated string is displayed, it doesn't get wrapped within [T] [/T] as the code reads (just tried understanding what I could from here: http://trac.symfony-project.org/browser/branches/1.2/lib/i18n/sfI18N.class.php)

Thanks

A: 

It is perfectly OK to translate into the same language & this does work for me now. I realized that my XML was not well-formed :(

Why my translations are not wrapped in [T] [/T] , I'm yet to discover

Prasad
There is a dtd for xliff files, which can help you see when it is well formed or not.
greg0ire
+1  A: 

In order to use the untranslated_prefix and untranslated_suffix markers, you need to switch on debug mode for i18n in the factories.yml of your app:

apps/frontend/config/factories.yml:

  i18n:
    param:
      debug: true

it's just up to you to decide which environment this needs to apply to.

Raise
thanks, yet to try this though!
Prasad