A tumblelog CMS built on AJAX, PHP and MySQL.

lang.functions.php 935B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. if(!defined('entry') || !entry) die('Not a valid page');
  3. /* ===========================
  4. gelato CMS - A PHP based tumblelog CMS
  5. development version
  6. http://www.gelatocms.com/
  7. gelato CMS is a free software licensed under the GPL 2.0
  8. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  9. =========================== */
  10. ?>
  11. <?php
  12. require_once("streams.class.php");
  13. require_once("gettext.class.php");
  14. function initLang($lang = "en") {
  15. global $l10n;
  16. $input = new FileReader(dirname(__FILE__).DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."languages".DIRECTORY_SEPARATOR.$lang.DIRECTORY_SEPARATOR."messages.mo");
  17. $l10n = new gettext_reader($input);
  18. }
  19. function __($text) {
  20. global $l10n;
  21. if($l10n)
  22. return $l10n->translate($text);
  23. return $text;
  24. }
  25. function T_ngettext($single, $plural, $number) {
  26. global $l10n;
  27. return $l10n->ngettext($single, $plural, $number);
  28. }
  29. ?>