Page 1 of 1
i18n
Posted: Sun Feb 19, 2017 3:38 am
by computergenius
I am having problems getting gettext() to work - and I also think that if/when I get it working, I won't be able to use it, as it appears that you have to restart Apache if you change the translations.
So, at the moment, I am just getting the English to appear, not the translation.
And, I wonder if I get it working, if it will work for this project, as it is on shared hosting, and I can't restart Apache.
So, three related questions:
Should I carry on trying to get it to work?
Have I misunderstood the "restart Apache" bit?
Are there alternatives?
Re: i18n
Posted: Sun Feb 19, 2017 2:58 pm
by Vegan
can you post some code with what you are trying to do?
Re: i18n
Posted: Sun Feb 19, 2017 3:27 pm
by computergenius
I have been giving it some thought, and decided not to use gettext(). There seem to be so many people having problems with it, and many negative comments about it.
I like poedit, so plan to use that to create a .po file. It seems to be easy to use for translators.
But then, I have written a translation file creation script which will read the contents of a .po file, and write it as a json file. Then I can load the json file, and read the translations. Seems to be a quick way to do it.
It has the advantage that my translation file creation script can be instructed to include all standard translations - like menus, which are often the same across the site, and can make small text files, perhaps one for each page, probably one for each group.
But as I never got it to work reliably, I have to ask! Do you REALLY have to restart apache after making changes when using .po and gettext() ?
Re: i18n
Posted: Mon Feb 20, 2017 3:50 pm
by Vegan
http://php.net/manual/en/function.gettext.php
the manual is kinda limited for this function
Re: i18n
Posted: Tue Feb 21, 2017 2:46 am
by computergenius
Yes, I have checked the manual, and many other places as well.
No real help, though.