How do you use gettext on server (Apache) you can’t restart?
Asked Answered
I

4

2

I asked this question on serverfault but I didn't get any response. I try here...

I developped a site on my web server at home.

When I modify the translation files, I have to restart the web server Apache.

/etc/init.d/httpd graceful

Easy...

Suppose that my site is hosted on shared host.

Suppose now I need to modify the translation files.

I can't restart the server...

How do you use gettext in this context?

Are you allow to restart the server with the option graceful only?

Does the share host restart the server once a day to resolve this kind of problem?

How do you work with such constraints?

Incubator answered 1/2, 2010 at 15:46 Comment(2)
checkout https://mcmap.net/q/548275/-how-to-clear-php-39-s-gettext-cache-without-restart-apache-nor-change-domain, no need to reboot apache nor change domain.Wasson
Could you please edit the selected answer with which advice helped you?Erik
P
2

the post here on the gettext function has some information for making gettext work without restarting apache:

http://www.php.net/manual/en/function.gettext.php#58310

Pete answered 1/2, 2010 at 15:50 Comment(0)
H
6

call clearstatcache();

after making translation from *.po to *.mo

Hey answered 23/9, 2013 at 6:51 Comment(0)
P
2

the post here on the gettext function has some information for making gettext work without restarting apache:

http://www.php.net/manual/en/function.gettext.php#58310

Pete answered 1/2, 2010 at 15:50 Comment(0)
A
2

You can rename your *.mo file and your gettext domain to flush gettext cache without restarting apache server.But in production environment,it's unsuitable.

Afrikander answered 6/2, 2012 at 8:10 Comment(0)
A
0

There is no other solution than to brutally force a cache miss for each and every *.mo file every time one of them changes. Change a single string? New cache era!

I do this by writing middleware that copies all *.mo files to a timestamp-named directory (the timestamp being that of the newest *.mo file) and updates the application config with the new message path - if the newest timestamp actually changed, that is. Thus textdomains are now loaded from completely different paths, and this is what finally manages to kill the stupid gettext cache stinking dead.

Arable answered 31/10, 2015 at 17:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.