Il 11:10, luned? 24 ottobre 2005, Walter Lorenzetti ha scritto:

>
> _() cannot redeclare in common.php
>
> so i had to modify the function from _() to leng_() and than i had to
> replace every _() to leng_() in every files where it was
>
> I don't known if other linux users had have this type of problem but i'
> have to do you a request.. why in pmapper2 we change this lenguage
> function? if isn't it a big problem?

Hello list, this is my first post on this list, I'm using pmapper for one of 
my web sites (not yet publically released, but it will be on line soon).

I had the same problem and I would suggest a solution that I've tested on my 
websites (but not with pmapper yet).

Most ISP don't install gettext or have an outdated version, that have problems 
with non-ascii msgid (this is a problem if the main language use UTF8 or 
ISO-8859-15 like italian sites do), a simple workaround is to use an emulated 
gettext if GNU gettext is unavailable:


 // gettext support
  require_once 'gettext/GetText.php';  // this need PEAR

  /*****************************************
  * LOCALE support for native language
  * gettext locale setup
  * can use both native and emulated gettext
  * this is automatically probed here
  */
  define('GETTEXT_NATIVE', 0);
  define('GETTEXT_PHP', 2);
  define('DEFAULT_GETTEXT', GETTEXT_PHP);

  GetText::init(DEFAULT_GETTEXT);
  GetText::setLanguage($langcode);                             // may throw 
GetText_Error
  GetText::addDomain(GETTEXT_DOMAIN, '../locale/' );          // may throw 
GetText_Error


  if(!function_exists('gettext')) {
    function _($text){return GetText::translate($text);}
  }

There are at least two emulation layers for gettext:
PHPTAL way
http://www.tcweb.org/doc/php4-gettext/html/index.html
WORDPRESS way
http://wiki.wordpress.org/WordPressLocalization

---------

This workaround should work in both cases: native and emulated gettext.

To solve the problem for non-ascii msgid if you use native gettext, it must be 
newer than Version 0.12 - May 2003.

Hope it helps.
-- 
Alessandro Pasotti
ICQ# 245871392
Linux User #167502

Reply via email to