Multi Language Error Messages
Something that is often overlooked in the multi language build process are multi language error messages.
If there is a problem with your site the vast majority of sites report issues in their base language, but how does this convey the issue to your site visitor that reads a different language?
What Is The Problem?
The problem is, there is a problem and you need to convey this to your visitors in their own language.
If you throw up a random error message in a language someone does not understand how can they possibly know what to do. If you are running a commercial website there is a very real chance you will lose that visitor as a potential customer/client forever.
You only get one chance to make an impression. Take an hour to ensure your error messages are in all the languages you support.
A good example is the 404 page not found message. Websites are fluid things, pages are added and deleted frequently. Links get broken and people are sent to pages that do not exist.
Any website worth it’s salt will throw a 404 page not found message. Here are mine in English and French.
I’ve coded my site up to recognise the language a visitor is using and show error messages in that language.
How I Solve This Problem
I solve this problem on my clients sites using my old friend the WPML plugin. For those not up to speed with WPML this is a comprehensive multi language solution, but one of it’s functions is called string translation. We can use this to translate error messages.
If your theme is coded correctly, string translation allows you to search for specific text strings such as “Error 404 – Page not found!” and add a translation, then when that string is displayed it checks for the language and shows the appropriate translation.
Super simple IF your theme is coded correctly.
If you theme is not coded correctly to output strings with a context, this will not work and some re-coding of the theme is required.
If you check your themes 404 file and see:
echo “Error 404 – Page not found!”; this will not work.
But if you see:
_e(“Error 404 – Page not found!” ,”webpolyglot”); this will work, we are outputting the string but instead of echoing the string directly we are sending the string through the translate() function.
Error Messages You Need To Think About
Here is a list of things you should be thinking about:
- 404 file not found
- Error messages on any contact forms, submission okay and submission not okay
- Login errors
- Search results returning no results
If you need help making sure all your error and customer facing messages are translated why not get a no obligation quote.