schmittjoh / JMSTranslationBundle

Puts the Symfony2 Translation Component on steroids
http://jmsyst.com/bundles/JMSTranslationBundle
426 stars 290 forks source link

Source language different from fallback locale #197

Open goetas opened 10 years ago

goetas commented 10 years ago

Hi! This is my config.yml

framework:
    translator:      { fallback: en }

jms_translation:
    source_language: it   
    locales:     
        - en
        - de
        - it

As you can see, my source language is Italian. The application should be available in Italian, English and German. If some German translations are not available, they should fallback to English (as configured in framework.translator.fallback Source code is in Italian, so Italian translation should be always available.

Here comes the undesired behavior:

The translation:extract command (using the XLIFF dumper) extracts all sentences marking them as new.

Italian translations are marked as new, so they are not available, so SF2 always fallbacks to English sentences.

Possible solution: When the extracted locale matches the source language, the extracted translations should be be marked as not new.

Ideas?

Nyholm commented 7 years ago

I guess you have Italian sentences in your source code. And since your Italian strings are marked as "new" you fallback on English.

I would say that this is a won't fix because using words instead of keys in the source code violates the Symfony best practices.

To fix this you could write a small script that removes the state="new" on your Italian translation files.

goetas commented 5 years ago

I would say that this is a won't fix because using words instead of keys in the source code violates the Symfony best practices.

it is a common thing to not use keys in translations and is common for many translation systems. XLIFF supports both Monolingual and Bilingual translations.

I do not see why this bundle should limit the functionality to only monolingual translations.