0

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?

1
  • Ask yourself one thing, is the code being redistributed... Whatever your answer to that question, it's also the answer to whether you should do translation.. (impo)..
    – t31os
    Commented Apr 4, 2011 at 12:20

3 Answers 3

3

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.

Benchmarks

enter image description here

1
  • interesting chart :) this is not for a client, but for a site of mine Commented Apr 8, 2011 at 16:30
1

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.

1

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:
enter image description here

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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