From: skaill <sk...@ro...> - 2004-08-17 12:29:26
|
Phil, take a look below at a snippet of code from InfoCentral's config file. They have already made an alias function, set the appropriate variables and done a fix for some inconsistency. It's probably what any of us would end up writing anyway and if nothing else is a further insight into gettext... Steve // Internationalization (I18n) support // Right now, InfoCentral supports US English (en_US), Italian (it_IT), French (fr_FR), and German (de_DE) $sLanguage = 'en_US'; // // SETTINGS END HERE. DO NOT MODIFY BELOW THIS LINE // putenv("LANG=$sLanguage"); setlocale(LC_ALL, $sLanguage); // Get numeric and monetary locale settings. $aLocaleInfo = localeconv(); // This is needed to avoid some bugs in various libraries like fpdf. setlocale(LC_NUMERIC, 'C'); // patch some missing data for Italian. This shouldn't be necessary! if ($sLanguage == "it_IT") { $aLocaleInfo["thousands_sep"] = "."; $aLocaleInfo["frac_digits"] = "2"; } if (function_exists('bindtextdomain')) { $domain = 'messages'; $sLocaleDir = "locale"; if (!is_dir($sLocaleDir)) $sLocaleDir = "../" . $sLocaleDir; bindtextdomain($domain, $sLocaleDir); textdomain($domain); } else { if ($sLanguage != 'en_US') { // PHP array version of the l18n strings $sLocaleMessages = "locale/" . $sLanguage . "/LC_MESSAGES/messages.php"; if (!is_readable($sLocaleMessages)) $sLocaleMessages = "../" . $sLocaleMessages; require ($sLocaleMessages); // replacement implementation of gettext for broken installs function gettext($text) { global $locale; if (!empty($locale[$text])) return $locale[$text]; else return $text; } } else { // dummy gettext function function gettext($text) { return $text; } } function _($text) { return gettext($text); } } ----- Original Message ----- From: "Daintrees" <p.d...@pa...> To: <web...@li...> Sent: Tuesday, August 17, 2004 6:18 AM Subject: Re: [Web-erp-developers] Translations > > I have been doing a little research ... > > http://www.appliedlanguage.com/articles/internationalization_using_php_and_get_text.shtml > > actually wrapping all strings in the gettext() function allows the strings > to be extracted automatically - this seems like a huge bonus to me. I think > I will experiment a bit and see if I can get a couple of scripts going - the > only real downer with this is that I only speak english perhaps I could give > my .po file to Rom to translate so we can see how a few scripts work. > > It seems pretty straightforward! > > Phil > > > ----- Original Message ----- > From: "skaill" <sk...@ro...> > To: <web...@li...> > Sent: Tuesday, August 17, 2004 8:40 AM > Subject: Re: [Web-erp-developers] Translations > > > > Sounds good. I'll be there. To do the majority of the work we just need > to > > find who all is involved, split the pages up between us and decide whether > > to use gettext() or an alias like _(). > > > > >From there each of us just finds all the strings in their pages and puts > in > > the function call. > > > > Steve > > > > ----- Original Message ----- > > From: "Daintrees" <p.d...@pa...> > > To: <web...@li...> > > Sent: Monday, August 16, 2004 4:26 PM > > Subject: Re: [Web-erp-developers] Translations > > > > > > > Luca is still away basking in the med sunshine but he preferred the db > > > approach. Luca was keen to get stuck in on his return and we should wait > > for > > > his input. However, I would like us to go ahead with the gettext > approach > > as > > > Hani who has done this already advises. There is quite a swag of > resources > > > around gettext and it appears almost a defacto standard. > > > > > > I think it is well known that my objection is to compromising the > > > readability of the code. Using gettext appears not to damage this too > > badly. > > > It might be an idea if those developers who are keen to be a part of > this > > > effort put their hands up and once the approach is clear then divide and > > > conquor > > > > > > Phil > > > > > > > > > > > > ------------------------------------------------------- > > > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > > > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > > > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > > > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > > > _______________________________________________ > > > Web-erp-developers mailing list > > > Web...@li... > > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > > > ------------------------------------------------------- > > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > > _______________________________________________ > > Web-erp-developers mailing list > > Web...@li... > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |