1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need a PHP Gettext example to work with

Discussion in 'General Programming Chat' started by Jesperj, Dec 13, 2013.

  1. Jesperj

    Jesperj Power Member

    Joined:
    Sep 10, 2010
    Messages:
    502
    Likes Received:
    347
    Occupation:
    Web Designer
    Location:
    Far, Far away
    Home Page:
    Hi guys

    Im trying to set up a basic test site to play with these GETTEXT translation method. I already used POEDIT with wordpress translations, and i like how easy it is to translate. So in order to add this to my own websites i create, i will need to learn how to use it.


    Ive tried following this: http://www.yourhowto.net/build-multilanguage-websites-with-gettext/


    But its not working, i have it displaying the text strings, ive created the .po and .mo files succesfully and it reads my strings, but i just dont know how to define those top variables, textdomain, domain and bindtextdomain etc.


    Hopefully some of you can help? i dont mind paying $10-20 or something for a working example that can show me how i do.

    Thanks in advance
     
  2. mypmmail

    mypmmail Junior Member

    Joined:
    Jan 31, 2008
    Messages:
    111
    Likes Received:
    27
    I think the $domain should remain as 'messages'

    Only the $bindtextdomain should be change to where your local files are located.
    For most hosting, it should looks something like
    /home/yourusername/public_html/locale

    If you do not know your hosting directory, just create a new php file with the following 1 line content
    <? phpinfo() ?>
    You should see your document_root

    HTH