Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a test for Translatable #107

Closed
wants to merge 1 commit into from
Closed

Conversation

chandon
Copy link

@chandon chandon commented Apr 26, 2014

Adding a test to check the capacity to add a new language/value for an
existing translatable entity.
At the time of this commit, there is an issue as the test fails (all new
language/values are added to "en" language)

Adding a test to check the capacity to add a new language/value for an
existing translatable entity.
At the time of this commit, there is an issue as the test fails (all new
language/values are added to "en" language)
@chandon
Copy link
Author

chandon commented Apr 27, 2014

Of course the Travis test fails, the test is here to proove that there is a failure with Translatable...

@DerekRoth
Copy link
Contributor

This test shows that there is a really huge bug in this behavior. In fact, it is unusable for adding new translations, as soon as the "en" translation exists. The fact that writing and reading translations use the same method for getting a Translation object seems to be a problem : getting the default language Translation for reading is fine, but not for writing.

DerekRoth added a commit to DerekRoth/DoctrineBehaviors that referenced this pull request Jun 9, 2014
@festlv
Copy link

festlv commented Jun 26, 2014

I can confirm that this problem affects newbies- if the default translation exists, it is always returned when calling translate('otherlocale'). That is not obvious at all looking at the example in documentation.

@ZeeCoder
Copy link

ZeeCoder commented Jul 9, 2014

I have this exact same issue.

@DerekRoth
Copy link
Contributor

I ended up using my own fork in composer to fix that issue since i don't have time to work on a much better fix...

@ZeeCoder
Copy link

ZeeCoder commented Jul 9, 2014

How did you fix the issue exactly?

@DerekRoth
Copy link
Contributor

I use this patch : DerekRoth@b292f57
and then when i need to get a translation object in order to write to it, i use this:
$myEntity->translate('fr', false);
If i just want to read from it and fallback to the 'en' translation if the one i am looking for does not exist (current behavior) i just use :
$myEntity->translate('fr');

@TomasVotruba
Copy link
Contributor

@chandon Could you add a code, that would make this test work, to this commit? I think it's necessary to keep test working, so it's ok to have a fix and test in one commit.

E.g. inspire by @DerekRoth solution.

@kuczek kuczek mentioned this pull request Oct 20, 2014
kuczek pushed a commit to kuczek/DoctrineBehaviors that referenced this pull request Oct 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants