Search code examples
phpgettextphp-gettext

Does gettext slow my PHP application down?


Does anybody know if the standard php gettext does slow down the web application?

If the .po file always had to be read, it would get really slow I guess. So I thought the technique used might be different (Caching? How does it work?). Could somebody please explain how gettext works in PHP from the performance point of view?


Solution

  • From my own experience translating an English web application with about ~300 unique strings to Chinese: I did not notice much of a difference. It felt just as snappy.

    I guess before you optimize prematurely based on guesses, you should check if it's actually a problem in your specific setup.

    BTW: the .po file is actually not parsed every time, it is translated into a binary .mo file