I'm currently setting up a multilanguage website that enables members to update their own information, news, events, etc. For adding and updating this personalized content I'm using safecracker and it's working fine. One thing I cannot get around is rather cosmetic but important for user experience: validation error messages.

I'm using different language packs to be able to view the inline error messages in the right language of the user. However the problem is that the is that the fieldname in the error message is the name of the field in EE, in my case it has been defined in English. The end result is that it displays the error half in English (the fieldname) and half in the userlanguage (e.g. dutch or french), like this

"Het veld Company Name is een verplicht veld"

Of course this does not make sense to an enduser... My question: is there a way to pass a variable to the {error:field_name} that can be used a field name in the error message e.g. {error:field_name label="Bedrijfsnaam"} (Bedrijfsnaam is Company Name in dutch fyi) so the error message then is shown completely in the correct language

"Het veld Bedrijfsnaam is een verplicht veld"

rg, Tim


The method above works, but to avoid annoyances with multiple validation rules, I came up with this work around.

Since I'm using inline errors and I am displaying the error just below the field where it occured, I've manually edited the languages file like in /system/expressionengine/language/dutch and I took out all the '%s' for the error messages where I don't need it. By doing this the name of the field is not shown in the errormessages

| improve this answer | |

It all depends on how you've setup your multi-lingual website but if you're following this type of method then you just need to throw in a conditional check for the language within your error checking, like this:

{if error:field_name}

    Default language error message

    {if language="en"}
        English error message


| improve this answer | |
  • Yes, this works but it is a bit annoying with multiple validation rules.. – Tim Bertens Apr 29 '13 at 16:25
  • You could make it easier with the Multi Language Module. – Ian Apr 29 '13 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.