But by using something like mod_itk (I believe cgi/fastcgi can do this to) you wont even have this problem no more. It's mostly just that you have to restart your apache when using mod_php or your gettext calls will fail (sometimes no translations returned, sometimes you end up with the beloved white page with no contents). Be aware that with mod_php it is not threadsafe, though I never had any hard problems. Other interesting Windows alternatives to Poedit are Virtaal, memoQ, LF Aligner and BabelEdit. If that doesn't suit you, our users have ranked more than 25 alternatives to Poedit and 11 are available for Windows so hopefully you can find a suitable replacement. So in fact you hit save and copy the file, sam as with editing a php-file.īut a real downside is, if you use mod_php. The best Windows alternative is OmegaT, which is both free and Open Source. Theby middus mentioned downside that you have to compile the po file while you could easy overwrite a php-file when using arrays - well you just overwrite your mo file too, and if using poedit, it does the compiling after saving the file. but beware, using poedit and doing a echo _('') is not a good idea, poedit uses the msgid "" for the project information which most likely you don't want to show your audience, so one must take care of not trying to translate empty strings :)Īlso it's very fast and has some additional features for plurals and stuff, also poedit for example makes the life easier by having a translation db so you must not translate the same stuff over and over again, those you did already will be prefilled and marked as "check if it's right". Using arrays like echo $translation and there is none, you will just see nothing. I recommend using gettext, I am doing that in PHP for 5 years with good results.įirst of all if you use echo _('my text to translate') and have no translation for it, you will see the original string in the output, which is good. I didn't want to use Zend_translate, I found it too complicated to my simple task, so I finally ended up using php define, but later on someone told me I should use arrays) (I first started with gettext, but it wasn't supported in my shared free hosting Zymic. Load the file of phrases to be translated into POEdit. Install and run POEdit, or some other translation program 3. Index.php?lang=spanish greeting turns to Hola Mundo Alternative method: off-line translation 2. Index.php?lang=spanish: turns to Hola Mundo And I don't have to create a folder for the "default language".Īre there other pros and cos of using gettext and php arrays for multilingual websites? So far the only 2 good things that I've seen about using gettext instead of arrays is that I don't have to create the "greeting" "sub-array" (or whatever its called).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |