Guest User

Untitled

a guest
May 26th, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Example of using gettext, the GNU Project that enables easy
  5. * internationalization (i18n). Please use gettext over coming up with
  6. * another scheme.
  7. *
  8. * @author vmc <vmc@codegroove.net>
  9. * @date 05.28.2010
  10. */
  11.  
  12. if ( false === function_exists('gettext') ) {
  13. echo "You do not have the gettext library installed with PHP.";
  14. exit(1);
  15. }
  16.  
  17. /**
  18. * Set the specific locale information we want to change. We could also
  19. * use LC_MESSAGES, but because we may want to use other locale information
  20. * for things like number separators, currency signs, we'll say all locale
  21. * information should be updated.
  22. *
  23. * The second parameter is the locale and encoding you want to use. You
  24. * will need this locale and encoding installed on your system before you
  25. * can use it.
  26. *
  27. * On an Ubuntu/Debian system, adding a new locale is simple.
  28. *
  29. * $ sudo apt-get install language-pack-de # German
  30. * $ sudo apt-get install language-pack-ja # Japanese
  31. *
  32. * You can also generate a specific locale using locale-gen.
  33. *
  34. * $ sudo locale-gen en_US.UTF-8
  35. * $ sudo locale-gen de_DE.UTF-8
  36. */
  37. setlocale(LC_ALL, 'de_DE.UTF-8');
  38.  
  39. /**
  40. * Because the .po file is named messages.po, the text domain must be named
  41. * that as well. The second parameter is the base directory to start
  42. * searching in.
  43. */
  44. bindtextdomain('messages', 'locale');
  45.  
  46. /**
  47. * Tell the application to use this text domain, or messages.mo.
  48. */
  49. textdomain('messages');
  50.  
  51.  
  52. $name = "Vic";
  53. printf(_("Hello, %s, it is nice to see you today.\n"), $name);
  54.  
  55. exit(0);
Add Comment
Please, Sign In to add comment