fr-CA translation of COM_FABRIK_FAILED_VALIDATION will not work

I created a new french - fr-CA - (which is just a copy of fr-FR so it coincides with my system language) and for the most part I'm not having any translation issues except in the component translation for validation that appears in the speech bubble above an element (ajax validation). When I change COM_FABRIK_FAILED_VALIDATION in
components/com_fabrik/language/fr-CA/fr-CA.com_fabrik.ini it doesn't work. If I change that same placeholder in components/com_fabrik/language/en-CA/en-CA.com_fabrik.ini it works and if I comment out that value in the en-CA it will default to the value in components/com_fabrik/language/en-GB/en-GB.com_fabrik.ini.
Now here's the kicker, if I try to save the form the validation error is rendered below the field correctly. Any ideas why or how these two validations read the translated version differently? You can see what I mean in my screenshots. The only one that isn't correct is the french_ajax_validation.png. Note it says "Validation failed3443" when it should have the same text as french_validation_after_save.png which shows "failed validation (fr) test". Instead it is rendering the value from components/com_fabrik/language/en-CA/en-CA.com_fabrik.ini.

english_ajax_validation.png english_validation_after_save.png french_ajax_validation.png french_validation_after_save.png

Last note, yes I do plan to override these placeholders in override language files, I'm only working at this level as I'm trying to debug my way through this one.
Shawn
 
Nope, got me beat.

Are you doing any of this in a content plugin? I did just notice that we seem to have that string in the language for plugins/content/fabrik, although not for all languages.

-- hugh
 
Note also I thought maybe it was code related. The code that renders this translation is in
./components/com_fabrik/models/validation_rule.php
The section that reads
if($v=== '')
{
$v= 'COM_FABRIK_FAILED_VALIDATION';
}
$this->errorMsg = FText::_($v);

And not being familiar with FText (I assume it's joomla's tranlsatable rendered formatted text) I tried using JText instead but still no luck. I also tried hardcoding to other placeholders and still the same behavior so I know it's not a typo or a issue with the placeholder itself.

Shawn
 
I can't replicate this.

http://screencast.com/t/B39D2fklOM

I installed the J! fr-CA language, set it as default for the site and my user. I copied fr-FR to fr-CA in the main Fabrik frontend language folder. Changed it, tickled a validation failure, and the changed version shows up for both the tooltip and the "under the element". Changed it again, same result.

Le validation c'est bolloxed.

-- hugh
 
FText::_() is our wrapper around JText::_(), which just does a little sanity checking to prevent some unwanted behaviour, then calls JText::_(). And JText::_() is indeed the J! library call to translate text.

As you can see in that screencast, I set a breakpoint in getMessage(), so I could confirm what's happening. And it's doing everything it should, I stepped through FText into JText, and it has correctly loaded the expected language.

-- hugh
 
If I set the site default to fr-CA as you did here, I will get the correct value in the speech bubble as you stated above but when you swap language back to en-CA with the language filter you get the opposite problem where now the value in the ajax validation is stuck at french whereas the under element text is correctly in english. Is the ajax validation tied to the system language default as opposed to the users chosen language?
 
OK, I'm having no luck at all getting this set up.

If you can give me a quick tutorial in how to set up for testing, I'll test it. :)

-- hugh
 
Hmm, well what part do you need a hand with? Or if you can give me access to your environment I can help? A few points:
1. Enable the Language Switcher Module
2. The attached screenshot shows my config for the language switcher
3. I have 3 languages, en-GB, en-CA and en-FR. I disabled en-GB, en-CA is the site default.
Let me know if there are any specifics you need information on
 

Attachments

  • Screen Shot 2015-12-23 at 9.59.27 PM.png
    Screen Shot 2015-12-23 at 9.59.27 PM.png
    113.2 KB · Views: 147
OK, I've set it up so I have two versions of a list, one on an en-GB menu, one on an fr-CA menu, I can switch between languages, go to the relevant menu item, and get the expected (correct) results with the validation string.

I guess I'll have to see exactly how you have things set up. Can you update your My Sites?

-- hugh
 
I've setup a student account so you can test in the application as well as an admin account so you can see my backend configuration. Please check in My Sites for login info. When testing as a student, use the french flag to swap language, click on 'next' at the bottom of the page to see the ajax output, and use 'enregistrer' to see the below the field validation. If you need any additional info, please let me know.
Thanks
Shawn
 
I'm trying to figure this out, but your site just started dying with an internal server error. Wasn't me, I was just loading a front end page. :)

-- hugh
 
OK, I think I've worked it out. I'm using SEF, and you aren't. So my base href for the validation AJAX calls has the /en/ or /fr-ca/ language part it it. Yours don't, they are the un-SEF'ed URLs, which rely on having &lang=xx in the query string, and that isn't happening on the AJAX calls. The query string lang is there on the URL when you click on the language selector flag, and (for instance) you can see the correct "please select" string in the Province dropdown as the page loads, but because that's a CDD, it immediately fires off an AJAX update for itself, which doesn't have the lang query string, so that changes to the default system language 'please select'. Likewise when the validation AJAX calls fire.

So I think a quick fix for this is to enable SEF.

The longer fix is for me to work out how we can preserve the lang=xx query string in our AJAX calls. Might take a while, as there's quite a few of them!

I'm guessing we've never noticed this before because not very many people have fully multi-language sites, and of those, most will use SEF.

-- hugh
 
I've started work on getting the multilang URL code appended to our AJAX calls, but it's going to take a while to get them all done. I've started with the validation, which seems to be working. I'll commit the code some time this week. But it'd probably be better for you to enable SEF anyway, which I'm fairly sure will resolve your issue, because as explained in my previous post, that means the base href for the page is already /fr-ca/ (or whatever the "URL language code" set in the content language admin is), which J!'s SEF routing automagically parses into the 'lang' query string input.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top