Alex Ception
Alex Ception

Reputation: 314

i18n extract does not create directories nor files in Symfony

I am trying to set up the i18n behavior on Symfony 1.4.18. I have some i18n-friendly strings (using the two underscores) in my frontend layout. I tried to run the command below :

$ ./symfony i18n:extract frontend fr --auto-save

At first, symfony found 17 strings, but didn't build the path apps/frontend/i18n/fr/ nor the file inside : messages.xml.

I re-ran the command above, but this time Symfony did not find any string. I thought, if Symfony does not find new strings, it might save it somewhere, so I ran another command on my Linux, to find any occurrences on one of my i18n strings (Typically I have this string : ) :

$ grep "Freelance" $(find ./)

This command was launched at the root of my project, but unfortunately it didn't find any occurrences except the one in my layout.

I don't know what to do anymore to solve my problem.

PS : I hope my english isn't too bad, it's not my native language, but I try to do my best.

Upvotes: 0

Views: 1566

Answers (4)

playmobox
playmobox

Reputation: 95

  1. Do this in your project root:

    sudo find . -print | grep -i 'messages.xml'
    
  2. Then delete the file (s) you found (probably within sfDoctrinePlugin/i18n in the symfony vendor files)

  3. Use the settings from above for your factory.yml and settings.yml

  4. Restart task:

     php symfony i18n:extract frontend fr --auto-save
    

    That's all. Now the messages.xml is generated. Missing folders are created.

  5. (Revert the chmod changes you did before)

Upvotes: 0

maxx
maxx

Reputation: 31

Try to add

messageSource: '%SF_APP_DIR%/i18n'

option to your i18n factory configuration.

And look for your messages.xml in app_dir/i18n/your_culture. Old messages.xml where at vendor/symfony/lib/plugins/sfdoctrineplugin/i18n in my case

Upvotes: 3

Faraona
Faraona

Reputation: 1700

Try to set i18n source in factories.yml

Something like this:

  i18n:
  class: sfI18N
  param:
    source:               XLIFF
    debug:                false
    untranslated_prefix:  "[T]"
    untranslated_suffix:  "[/T]"
    cache:
      class: sfFileCache
      param:
        automatic_cleaning_factor: 0
        cache_dir:                 %SF_I18N_CACHE_DIR%
        lifetime:                  31556926
        prefix:                    %SF_APP_DIR%/i18n

here you can find more information.

Upvotes: 0

Vlad Jula-Nedelcu
Vlad Jula-Nedelcu

Reputation: 1696

Your default language is fr and you're trying to get the translations to fr?

The xml files should have the source string (in french - your default language) and target string (in english or whatever).

Try ./symfony i18n:extract frontend en --auto-save (or whatever language you want, other than french) and let us know if you'll get what you need.

Upvotes: -1

Related Questions