Does anyone know how much do the localization functions from WordPress affect the speed of a website?
Do you think it's worth replacing all strings with gettext inside a theme, even if it will only be used on a single, english website?
Does anyone know how much do the localization functions from WordPress affect the speed of a website?
Do you think it's worth replacing all strings with gettext inside a theme, even if it will only be used on a single, english website?
If you know that you or the client will NEVER need to be translated there is no need to replace all the strings within your theme with gettext.
Regarding the performance issue I found a benchmark comparing the 3 gettex methods. It also compared using the default local vs a different local and the differences were negligible which leads me to the conclusion that that you do take a performance hit when replacing all your strings with gettext.
I agree with Chris_O:
If you know that you or the client will NEVER need to be translated there is no need to replace all the strings within your theme with gettext.
But with that said if you are releasing or distributing the plugin or theme to the public then you should wrap your strings with gettext, and make the life's of none English speaking WordPress Users easier.
There is an alternative: Let your client alter the strings and store them in theme options. I did this just recently for a theme which will be used on many different blogs.
Screenshot of the backend:
Alle strings are stored in one option array, which reduces the performance overhead to one cached DB query. And the client has a better interface and more freedom to edit the fields.
This approach doesn’t work well if your theme is used in many different languages, because you have to offer useful default values for each of them. But for a simple use case with just three or four languages it works quite well.