last day (14 days later) » 

2:08 PM
0
Q: FOSUserBundle : Translations unreachable

watteverI'm facing an issue I can't seem to solve by myself: We're currently working on a project using FOSUserBundle under Symfony 2.3. It seems that one of my coworker messed up with the default FOSUser Dictionnary. Everytime we try to call any of the usual messages, either we get an empty result, or...

 
Check out app/Resources/FOSUserBundle/translations/FOSUserBundle.en.yml. Does it exist?
 
In app/Resources/FOSUserBundle/ I only have "views"
 
Okay, now in your app/config/config.yml is the translator line enabled? Should look something like translator: { fallback: "%locale%" } or en in place of %locale%
 
That would work only if my problem was translation-related. Unfortunately I get this problem everytime I call any of this bundle message
 
You said yourself you found the "wording" files under a translations folder. So, logically, it would make sense to ensure your translator is enabled. Can you please enable the line and confirm?
 
2:08 PM
still the same error when setting translator: { fallback: fr } I only get the value registration.flash.user_created (which is correctly defined in FOS YAML)
 
Silly question but I want to get the obvious out of the way. Did you try running php app/console cache:clear and php app/console cache:clear --env=prod?
 
yep we did
 
I suppose you don't use version control for this project.. You could run a git diff to see where your coworker messed up
 
We use SVN so basically I could, but since this is a project we're currently building, I have about 2000 commits and about as many files
any idea which config file I could look into?
 
and no approximate guess as to the commit that was good or bad?
 
2:12 PM
hehe, have you ever worked with interns? :P
 
lol
Branching would be useful for you guys then
but this is an aside
the other place I forgot to ask about was app/Resources/translations
anything in there?
 
I know, I'm working on it...
nope, no translation dir under app/ressources
 
Are any of your custom bundles extending FOSUserBundle?
 
not that I know of
 
See if you can do a grep search for getParent() in the bundle files
that function is used to define parent bundles
 
2:15 PM
I've been able to locate another validator.fr.yml file under our MainBundle
 
Yeah that's the wrong translation domain though
 
$translatableClass = $form->getParent()->getConfig()->getDataClass();
somethinh I should dig deeper?
 
Nope
This reference talks about which translation files win
So app/Resources/translations was my last guess because of how it always wins
 
Do you think A2lix Translation Bundle could interfere with FOS?
 
next guess is to try and move the FOSUserBundle declaration down to the bottom of your AppKernel.php file
Checking...
 
2:18 PM
according to my current AppKernel, FOS comes way before the LexikTranslationBundle
 
Well, easy way to check would be to disable the LexikTranslationBundle, or bring FOS down to the absolute last, or both
but first try moving FOSUserBundle down to the bottom and then clear those caches
 
Trying...
 
What's weird is that if there are any translation overrides, it shouldn't be killing the translations altogether
For example I have a translation override for FOSUserBundle and the only parameter I modified was registration.flash.user_created
rest of the file, completely blank
 
Story of my life bro, everytime they screw up with their project, it's the only explaination they give me "It shouldn't do that"
 
lol
Can you safely disable LexikTranslationBundle?
 
2:23 PM
safely I don't know, but I can try to disable it for sure
 
And of course clear caches once you've done that
 
Still trying the first solution (move FOS to the bottom)
no success, and no way I can remove the other Bundle, plenty of lines mention it
 
Call me crazy, but if you ran composer update, maybe it will catch some modifications to the vendor folder
I don't trust these interns to not touch that folder all of a sudden
 
I was thinking about it at first, but then I realized that everything has been settled by interns... meaning if I update that sh**, it will most likely blow up
 
It shouldn't.. All composer update does is fix the vendor folder if it has any mods and also installs any newer versions of bundles if made available according to the composer.json file
You can backup the vendor folder just in case though
 
2:32 PM
yep good idea, I'll give it a shot
thanks a lot man, I don't want to waste your time any longer. Realy appreciate your help
 
Eh, did it work?
Happy to help of course. Just killing time at work, slow days at the office
 
wich I could say the same
we're still trying all of your solutions, crossing fingers, it will work some day :)
 
It could be something quite obvious. I've noticed @jperovic has joined here so they may also have further ideas
 
Yep, just saw that
'morning everyone!
any fresh idea?
 
2:51 PM
Hmmm can you trying installing a new copy of Symfony2 + FOSUserBundle and then try diff-ing the FOSUserBundle directory with the one from your project?
Maybe it's not the files but something in .php files
 
that could be an idea, I have another project to deploy...
 
If I remember correctly, if you run composer install/update it will warn you as soon as it sees that the file has been altered...
 
@jperovic Correct, it will prompt you and ask if you want to discard the changes
 
that's what I thought, but when sjagr told me to update, nothing poped-up, it just went through with no warning
 
So then the vendor folder has been left untouched
 
2:53 PM
Ooor, forget about deploying another symfony2 instance - just download FOSUseBundle the tar from github, untar it and then diff
hmm
 
@jperovic He'll definitely see different files depending on which version of FOSUserBundle he's using
So if you do that, make sure you download the tar/zip of the tagged version you're working with
 
Yes, exactly :)
 
OK I'l do that then. Hope this will show some differences
 
It's still kinda redundant since composer update checks for any diffs anyways
 
appart from that, there is absolutely no other place I can override some dictionnary settings?
 
2:55 PM
I don't think your dictionary settings are overridden
I think they're missing
 
they're not, they're right in front of my eyes
at their regular places
just that when they get called, nothing else but their value pops-up
 
No, missing from Symfony's eyes. If they were overridden, you wouldn't be seeing the raw variables
you would just see overridden variables
because again, an empty translation file just does nothing
 
since I'm calling the raw variable, nothing tells me it's a variable or a string
 
you can "pick and choose" which values you want to override, and the others remain untouched
 
I know, that's what made me think of an overriden conf, otherwise, only the choosen values would have been edited or not found
 
2:58 PM
Can you actually try putting some foobar translation into app/Resources/FOSUserBundle/translations/FOSUserBundle.fr.yml
?
 
Yes, or even a value for registration.flash.user_created
making sure you flush caches between each suggestion, of course.. :P
 
I've just tried something similar. just to see what would happen, I've copied the whole translation directory from FOS to app/ressourses/fosuserbundle
guess what... still nothing... :(
 
Well
The hell happened there? :)
@wattever cache:clear after that?
 
and you're sure that the translator service is enabled??
 
yep, everytime I try something new I cache:clear
what made me sure is that I get no error when calling it
 
3:01 PM
How about trying a grep on all of your config files for translator... maybe that config is getting overridden elsewhere
check your Bundle configs too...
 
One very important factor here: What OS are you running this OS?
*running this on?
Linux or Windows?
 
Linux
 
If the answer is Linux, beware of file naming case sensitivity...
 
I think we're looking in the wrong place
Something tells me it's the configs
did you try the grep?
 
arguments: ["@request", "@translator"]
sorry
wrong window
:)
I think you guys gave me a good overview about what I should do.
g2g, already late for my meeting.
I'll keep my thread updated. Hope that might help someone in case I find a solution
thx everyone
 
3:08 PM
Keep us posted. Have a good one
 
good hunting :)
 
cheers
 

last day (14 days later) »