[PHP] [SOLVED] How do you use php-gettext?
Now it works... I do not know why but it works. Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ Michelle Konzack http://www.can4linux.org/ Apt. 917 http://www.flexray4linux.org/ 50, rue de Soultz Jabber linux4miche...@jabber.ccc.de 67100 Strasbourg/France IRC #Debian (irc.icq.com) Tel. DE: +49 177 9351947 ICQ #328449886Tel. FR: +33 6 61925193 signature.pgp Description: Digital signature
[PHP] Re: [SOLVED] How do you use php-gettext?
There are two example coming with php-gettext package. However, it is realy easy since you have to use only: print T_gettext(Hello World); or print sprintf(T_ngettext(%i Developer, %i Developers, ${COUNT}), $COUNT); Run the command xgettext -k T_gettext -k T_ -L PHP -o script.pot script.php and then you have the Translation Template. Copy it to your desired language like cp script.pot script.po and translate the msgstr. Not call the command msgfmt -o script.mo script.po and copy the file script.mo to your desired locale directory with e.g. cp script.mo /var/www/locale/de/LC_messages/ and then setup your script.php to use [ 'script.php' ] ?php define(PROJECT_DIR, realpath('/var/www')); define(LOCALE_DIR, PROJECT_DIR .'/locale'); define(DEFAULT_LOCALE, 'en_US'); require_once('/usr/share/php/php-gettext/gettext.inc'); $supported_locales = array('de_DE', 'de', 'en_US', 'en'); $encoding = 'UTF-8'; $locale = (isset($_GET['lang']))? $_GET['lang'] : DEFAULT_LOCALE; T_setlocale(LC_MESSAGES, $locale); $domain = 'script'; bindtextdomain($domain, LOCALE_DIR); bind_textdomain_codeset($domain, $encoding); textdomain($domain); print T_gettext(The rest of your script); ? 8-- Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ Michelle Konzack http://www.can4linux.org/ Apt. 917 http://www.flexray4linux.org/ 50, rue de Soultz Jabber linux4miche...@jabber.ccc.de 67100 Strasbourg/France IRC #Debian (irc.icq.com) Tel. DE: +49 177 9351947 ICQ #328449886Tel. FR: +33 6 61925193 signature.pgp Description: Digital signature
[PHP] How do you use php-gettext?
Hello, I am trying to i18n a website using php-gettext with strings like T_gettext(Hello World) the problem is, they are inside the PHP scripts and xgettext does not find them to write the POT files. How do you use php-gettext and get the POT files to translate it? Note: Writing all strings in on file which then will be include is no option, since they are to many strings... Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ Michelle Konzack http://www.can4linux.org/ Apt. 917 http://www.flexray4linux.org/ 50, rue de Soultz Jabber linux4miche...@jabber.ccc.de 67100 Strasbourg/France IRC #Debian (irc.icq.com) Tel. DE: +49 177 9351947 ICQ #328449886Tel. FR: +33 6 61925193 signature.pgp Description: Digital signature
[PHP] gettext online editor?
hello, for translating our web applications, we use to create an XML file with the labels; one label for each entry; one file for each language. This let us: 1. create one file (in french) and let someone do the translations 2. provide the 'key users' (admins) of the application a php page that can be used to edit/change these translations 3. include the xml files into our cvs so that changes are managed 4. provide a new language to the application simply by adding the corresponding file if needed, we can split the file on a functional basis to reduce the amount of data to be loaded. Most of the time however, we simply have some form labels, feedback messages, menu items : less than 50 labels per page. So this works very well. Recently a collegue showed us gettext. As it seems very powerful, the main disadvantage I can see is that translations files are not directly editable. The admin users cannot edit the files and correct/change the translations. Moreover, we work mainly on windows and I'd rather minimize the number of softwares needed by the developers to do their work (php editor, oci, mysql, mssql clients, cvs, svn, firefox, moz, ie, uml editor, ... so many already!) So my question is: do you know if there is any way of editing the gettext translation files from a http page? I mean, without the need to execute a 'compile' (or whatever) action on the webserver. do you have any comment on translating the applications? of course gettext seems powerful, with caching an so on. But I really believe the new SimpleXML can load a translation file very quickly, and php offers enough functionalities to do cache of the labels in the current language... thank you Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettext online editor?
- Original Message - From: Vincent DUPONT [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tuesday, February 27, 2007 10:33 PM Subject: [PHP] gettext online editor? hello, for translating our web applications, we use to create an XML file with the labels; one label for each entry; one file for each language. This let us: 1. create one file (in french) and let someone do the translations 2. provide the 'key users' (admins) of the application a php page that can be used to edit/change these translations 3. include the xml files into our cvs so that changes are managed 4. provide a new language to the application simply by adding the corresponding file if needed, we can split the file on a functional basis to reduce the amount of data to be loaded. Most of the time however, we simply have some form labels, feedback messages, menu items : less than 50 labels per page. So this works very well. Recently a collegue showed us gettext. As it seems very powerful, the main disadvantage I can see is that translations files are not directly editable. The admin users cannot edit the files and correct/change the translations. Moreover, we work mainly on windows and I'd rather minimize the number of softwares needed by the developers to do their work (php editor, oci, mysql, mssql clients, cvs, svn, firefox, moz, ie, uml editor, ... so many already!) So my question is: do you know if there is any way of editing the gettext translation files from a http page? I mean, without the need to execute a 'compile' (or whatever) action on the webserver. You might want to check PHP-gettext at http://savannah.nongnu.org/projects/php-gettext/. Since it reads external gettext files and stores them internally in PHP data structures (well, arrays) you might patch their data structures. Anyway, it might not be better than your current setup. do you have any comment on translating the applications? yes, but they are in Spanish, (http://www.satyam.com.ar/blog/2007/01/17/internacionalizacion-y-localizacion-indice/) sorry, Europeans often are multi-lingual, perhaps ... of course gettext seems powerful, with caching an so on. But I really believe the new SimpleXML can load a translation file very quickly, and php offers enough functionalities to do cache of the labels in the current language... thank you Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.4/703 - Release Date: 26/02/2007 14:56 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GetText string not found
Is strange that there is not a really good solution for this problem, i think its not very strange. Maybe i ll request this feature, I think is interesting, useful and not so hard to add. Anyway, I cannot use ob_ functions, i ll have problems with some functions. So, the solution seems to extend _ function, that provides me the posibility to report strings not found. The bad think is that I ll have to make thousands of modifications in order to implement this feature in the webpage :( Thanks to everybody! Richard Lynch wrote: On Tue, June 13, 2006 6:30 am, Ruben Rubio Rey wrote: I am using gettext to get a web page in several languages. When gettext does not found an string, it shows the string. Is it possible to detect when a string is not found, in order to advis me ? My experience, if you call it that, with gettext consists of reading the manual and saying Neat!, so take this with a HUGE grain of salt... One option that MIGHT work would be: function ___ ($string) { //check for existince of the language file/string by hand :-( } Another option, perhaps, would be to have your default language be something really... weird, and then the output itself would be icky... I suppose you could do something hacky like: ?php ob_start(); __'GETTEXT_START_MARKER This is the actual message GETTEXT_END_MARKER'; ? All code/html here. ?php $output = ob_get_contents(); preg_match_all('/GETTEXT_START_MARKER (.*) GETEXT_END_MARKER/U', $output, $gettexts); foreach($gettexts[1] as $unknown){ error_log($unknown); } $output = str_replace(array('GETTEXT_START_MARKER ', ' GETTEXT_END_MARKER'), '', $output); echo $output; ? Ugh. Maybe a Feature Request at GetText and/or bugs.php.net would be in order... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GetText string not found
Hi, I am using gettext to get a web page in several languages. When gettext does not found an string, it shows the string. Is it possible to detect when a string is not found, in order to advis me ? Thanks in advance, Ruben Rubio Rey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GetText string not found
Ruben Rubio Rey wrote: Hi, I am using gettext to get a web page in several languages. When gettext does not found an string, it shows the string. Is it possible to detect when a string is not found, in order to advis me ? sure in a very simplistic manner; function __($s) { $r = _($s); if ($r === $s) logUntranslatedStr($s); return $r; } but the php gettext extension does not seem to provide such a functionality natively. Thanks in advance, Ruben Rubio Rey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GetText string not found
On Tue, June 13, 2006 6:30 am, Ruben Rubio Rey wrote: I am using gettext to get a web page in several languages. When gettext does not found an string, it shows the string. Is it possible to detect when a string is not found, in order to advis me ? My experience, if you call it that, with gettext consists of reading the manual and saying Neat!, so take this with a HUGE grain of salt... One option that MIGHT work would be: function ___ ($string) { //check for existince of the language file/string by hand :-( } Another option, perhaps, would be to have your default language be something really... weird, and then the output itself would be icky... I suppose you could do something hacky like: ?php ob_start(); __'GETTEXT_START_MARKER This is the actual message GETTEXT_END_MARKER'; ? All code/html here. ?php $output = ob_get_contents(); preg_match_all('/GETTEXT_START_MARKER (.*) GETEXT_END_MARKER/U', $output, $gettexts); foreach($gettexts[1] as $unknown){ error_log($unknown); } $output = str_replace(array('GETTEXT_START_MARKER ', ' GETTEXT_END_MARKER'), '', $output); echo $output; ? Ugh. Maybe a Feature Request at GetText and/or bugs.php.net would be in order... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext() troubles
Hello List, I am facing some troubles with gettext. phpinfo() says that both of gettext and iconv extensions are installed properly, I can call gettext() function but it never translates my strings returning the original key every time. Here is the code: ?php putenv(LANG=ru_RU); setlocale (LC_ALL,ru); $domain = 'messages'; echo bindtextdomain ($domain, 'D:\intranet\wwwroot\lng'); echo textdomain ($domain); echo bind_textdomain_codeset($domain, 'UTF-8'); echo gettext(string); ? Below is the output: D:\intranet\wwwroot\lng messages UTF-8 string All of the language files are in the following location: D:\intranet\wwwroot\lng\ru\LC_MESSAGES\ D:\intranet\wwwroot\lng\ru\LC_MESSAGES\messages.po D:\intranet\wwwroot\lng\ru\LC_MESSAGES\messages.mo The files were created with poEdit utility and look fine. Any help would be greatly appreciated. Have a great day, Denis S Gerasimov Web Developer Team Force LLC Web:http://www.team-force.org/ www.team-force.org RU Int'l: +7 8362-468693 email:[EMAIL PROTECTED]
Re: [PHP] gettext() troubles
Denis Gerasimov wrote: ?php putenv(LANG=ru_RU); setlocale (LC_ALL,ru); $domain = 'messages'; echo bindtextdomain ($domain, 'D:\intranet\wwwroot\lng'); echo textdomain ($domain); echo bind_textdomain_codeset($domain, 'UTF-8'); echo gettext(string); ? Here's what I use to set my language (to French in this case). It works 100% of the time for me: // Set locale to preferred language setlocale(LC_ALL, 'fr_FR'); bindtextdomain('messages', $_SERVER['DOCUMENT_ROOT'].'/locale'); textdomain('messages'); I don't do the putenv line that you have, so I'm not sure if it's necessary... -- Aaron Gould Programmer/Systems Administrator PARTS CANADA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettext() troubles
Aaron Gould wrote: Denis Gerasimov wrote: ?php putenv(LANG=ru_RU); setlocale (LC_ALL,ru); $domain = 'messages'; echo bindtextdomain ($domain, 'D:\intranet\wwwroot\lng'); echo textdomain ($domain); echo bind_textdomain_codeset($domain, 'UTF-8'); echo gettext(string); ? anyone who has worked with locales on different machines/platforms will probably run into the problem that locales are different and/or differently named on alot of systems... for this reason (I believe) set_locale() allows you to pass an array of locale names as the second arg - the first one found will be used... e.g. (I use dutch locales alot): setlocale( LC_ALL, array('[EMAIL PROTECTED]', 'nl_NL', 'nld_nld', 'Dutch', 'Dutch_Netherlands.1252', 'nl_NL.ISO8859-1', 'nl') ); maybe that helps a bit. Here's what I use to set my language (to French in this case). It works 100% of the time for me: // Set locale to preferred language setlocale(LC_ALL, 'fr_FR'); bindtextdomain('messages', $_SERVER['DOCUMENT_ROOT'].'/locale'); textdomain('messages'); I don't do the putenv line that you have, so I'm not sure if it's necessary... it sometimes is I believe - depends on your setup (e.g. if your using CGI version) - don't hold me to that I could be completely wrong. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext best practice
How do you people best deal with text meant for i18n via gettext, which is either large or contains HTML tags, or both? The GNU gettext manual, in section 3.2, recommends to split long texts at paragraph level, or in the case of long --help screens, in batches of 5-10 lines at most. I can dig this, but I'd still appreciate some feedback. Formatting, however, is a slightly different issue. The manual seems to have been written mainly for C users, and as such only deals with spaces, tabs and newlines. Of course, structural HTML is a big no-no IMO (ie. the likes of p, li or tables). But styling HTML is often needed (strong, em ...). Am I right in assuming that a small set of pure style-related HTML should be allowed? I'm thinking strong, em, del and ins. The alternative of replacing them with %s instead and inserting them in the code on the fly looks like an attrocity to me. And allowing any tags still doesn't make me 100% happy; consider borderline complications due to HTML vs XHTML, or the very principle of separating content from presentation, which seems to be breached. And how should br be dealt with? Allow it, or go with newlines instead, and decide in the code if I want to apply a nl2br() or not? -- Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext - multi text domains ?
Hi, I haven't yet started with gettext, but I consider to use it. Is it possible to use several text domains of gettext together? For example: I got 2 basic GUIs with their own text domains. I want to combine both the GUIs together, so is it possible to use the text domains of both the GUIs simultaneous? If yes, when I get an expression key that exists in both text domains, with which text domain it will be translated? Thanks in advance, -Eli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext does not translate
Hello! I wrote this skript, but gettext returns only the english string. I could not find a bug at bugs.php.net, so I think I forgot something. I have Debian Linux, PHP Version 4.3.4 and Gettext 0.14.1 (PHP and Gettext as debian pakages) gettext.php in /var/www/gymbay/ ?php // Set language to German setlocale(LC_ALL, 'de_DE'); // Specify location of translation tables bindtextdomain(messages, i18n); // Choose domain textdomain(messages); // Translation is (should) looking for in i18n/de_DE/LC_MESSAGES/messages.mo now // Print a test message echo gettext(Welcome to My PHP Application); // Or use the alias _() for gettext() echo _(Have a nice day); // Output: // Welcome to My PHP ApplicationHave a nice day ? messages.po # translation of messages.po to german # This file is distributed under the same license as the PACKAGE package. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER. # Christian Dvid [EMAIL PROTECTED], 2004. # msgid msgstr Project-Id-Version: messages\n Report-Msgid-Bugs-To: \n POT-Creation-Date: 2004-09-11 15:50+0200\n PO-Revision-Date: 2004-09-11 15:52+0200\n Last-Translator: Christian Dvid [EMAIL PROTECTED]\n Language-Team: \n MIME-Version: 1.0\n Content-Type: text/plain; charset=UTF-8\n Content-Transfer-Encoding: 8bit\n X-Generator: KBabel 1.3.1\n Plural-Forms: nplurals=2; plural=(n != 1);\n #: gettext.php:15 msgid Welcome to My PHP Application msgstr Willkommen zu meiner PHP Anwendung #: gettext.php:18 msgid Have a nice day msgstr Wir wnschen Ihnen einen schnen Tag and the messages.mo is in /var/www/gymbay/i18n/de_DE/LC_MESSAGES/ Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettext does not translate
Did you restart apache after creating your mo file ? Look at the first comment on http://ca3.php.net/gettext You might be facing this issue. Yann On September 11, 2004 10:08, Christian David wrote: Hello! I wrote this skript, but gettext returns only the english string. I could not find a bug at bugs.php.net, so I think I forgot something. I have Debian Linux, PHP Version 4.3.4 and Gettext 0.14.1 (PHP and Gettext as debian pakages) gettext.php in /var/www/gymbay/ ?php // Set language to German setlocale(LC_ALL, 'de_DE'); // Specify location of translation tables bindtextdomain(messages, i18n); // Choose domain textdomain(messages); // Translation is (should) looking for in i18n/de_DE/LC_MESSAGES/messages.mo now // Print a test message echo gettext(Welcome to My PHP Application); // Or use the alias _() for gettext() echo _(Have a nice day); // Output: // Welcome to My PHP ApplicationHave a nice day ? messages.po # translation of messages.po to german # This file is distributed under the same license as the PACKAGE package. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER. # Christian Dvid [EMAIL PROTECTED], 2004. # msgid msgstr Project-Id-Version: messages\n Report-Msgid-Bugs-To: \n POT-Creation-Date: 2004-09-11 15:50+0200\n PO-Revision-Date: 2004-09-11 15:52+0200\n Last-Translator: Christian Dvid [EMAIL PROTECTED]\n Language-Team: \n MIME-Version: 1.0\n Content-Type: text/plain; charset=UTF-8\n Content-Transfer-Encoding: 8bit\n X-Generator: KBabel 1.3.1\n Plural-Forms: nplurals=2; plural=(n != 1);\n #: gettext.php:15 msgid Welcome to My PHP Application msgstr Willkommen zu meiner PHP Anwendung #: gettext.php:18 msgid Have a nice day msgstr Wir wnschen Ihnen einen schnen Tag and the messages.mo is in /var/www/gymbay/i18n/de_DE/LC_MESSAGES/ Thank you! pgpGBFzO1baec.pgp Description: signature
Re: [PHP] gettext does not translate
Yann Larrive wrote: Did you restart apache after creating your mo file ? You are right, thank you. But there where another mistake, too. My system doesn't like de_DE, it wants to have [EMAIL PROTECTED]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettext: changed .mo file, caching issue
daniel hahler wrote: This works good, but if the .mo file gets changed the old content is returned by calls to gettext, until I restart Apache. gettext uses a caching method to speed up looking translation strings, which explain why Apache must be reloaded [1] Setting all LANG, LANGUAGE and LC_ALL _seems_ mandatory to avoid problems with some servers (I saw this with win2000 and linux). That's really poorly documented in [2], like the path used to find the .mo files Ex for french: wich of fr/ fr_BE/, fr_FR/, french/ ? Answer depend on OS (win/unix), server (locale config, env vars, ...) and I dont know what (sometimes uses fr when fr_BE dont exist)... Perhaps you can try php-i18n mailing list, which is really low traffic. [1] GNU gettext info manual GNU `gettext' caches previous translation results. When the same translation is requested twice, with no new message catalogs being loaded in between, `gettext' will, the second time, find the result through a single cache lookup. [2] PHP Manual http://www.php.net/manual/en/function.gettext.php Christophe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettext: changed .mo file, caching issue
About performance issues surrounding i18n, is gettext better than storing strings in a RDBMS ? Can someone argue in favour or again opinion that say the RDBMS way is faster ? [1] [1] Re: [Phpgroupware-users] I18N: why not gettext?! http://mail.gnu.org/archive/html/phpgroupware-users/2003-04/msg00209.html Christophe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettext: changed .mo file, caching issue
on Mon, 29 Sep 2003 10:24:09 +0200 Christophe Chisogne wrote: This works good, but if the .mo file gets changed the old content is returned by calls to gettext, until I restart Apache. CC gettext uses a caching method to speed up looking translation CC strings, which explain why Apache must be reloaded [1] That's bad, as I cannot restart Apache at my remote hosts computer.. I also found a blog entry, saying that Because when PHP is running as an Apache module, each page gets handled by a separated thread of the same process. And the problem is, you set the language by writing a variable to the environment (puttenv()). That's how gettext works. Unfortunately, changing the environment affects the whole process... thus all running (sleeping indeed ) threads for that process! see http://fplanque.net/Blog/devblog/2003/08/20/p355 That would mean that two different people accessing the page at the same time could get mixed up translations, as through PutEnv usage? CC Perhaps you can try php-i18n mailing list, which is really low CC traffic. Thanks for the hint. Just went through the archive, but did not find a good solution. Also discovered this list in the past days through google. So, I think I'll go back to simple include(). Still I have to think about using a single big one for each language or seperate it for sections with more content.. :/ -- shinE! http://www.thequod.de ICQ#152282665 PGP 8.0 key: http://thequod.de/danielhahler.asc I'm sitting in silence or radio music. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext: changed .mo file, caching issue
Hello php-general, I init gettext with putenv('LANGUAGE='.$language); putenv('LANG='.$language); // Specify location of translation tables bindtextdomain (messages, ./locale); // Choose domain textdomain (messages); where $language is either de or en. This works good, but if the .mo file gets changed the old content is returned by calls to gettext, until I restart Apache. This is with my local server. On the remote server, where I upload the files there is even no translation ATM, although there already has been some. my local server is: Apache 1.3.27 PHP 4.3.3 LoadModule php4_module c:/www/php/sapi/php4apache.dll remote server is also Apache/1.3.27 (Linux/SuSE) PHP/4.3.3 mod_perl/1.27 Any solutions? -- shinE! http://www.thequod.de ICQ#152282665 Dj Sosse - Summerscream II rocks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext i18n
Hi, I want to add i18n support for my web site, but it doesn't seem to work. PHP 4.3.3., Apache 1.3.28, Mandrake 9.0 Here comes the test code. As you can see I try all sorts of things. ?php echo putenv(LANG=de) . 'br'; echo putenv(LC_ALL=de) . 'br'; echo setlocale(LC_ALL, de, german) . 'br'; echo bindtextdomain(messages, /www/locale) . 'br'; echo textdomain(messages) . 'br'; echo gettext(User) . 'br'; echo strftime (%A %e %B %Y, time()) . 'br'; ? The funny thing is that strftime prints correctly. Any ideas Catalin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Gettext not loaded even when configured
I am trying to use gettext with Horde and Horde's test page says I do not have gettext installed. When I check my phpinfo() I see it listed there in the config line: './configure' '--with-apxs=/usr/local/apache/1.3.27/bin/apxs' '--with-config-file-path=/usr/local/lib' '--disable-debug' '--enable-memory-limit' '--enable-zend-multibyte' '--with-regex=system' '--enable-mbstring=all' '--enable-mbregex' '--enable-dio' '--enable-versioning' '--with-msql=shared' '--with-bz2=shared,/usr' '--enable-sockets=shared' '--with-pcre-regex=/usr/local' '--with-iconv=shared,/usr/local' '--with-gdbm=shared,/usr/local' '--with-db3=shared,/usr/local' '--with-gettext=shared,/usr/local' '--with-curl=shared,/usr/local/curl' '--with-openssl=shared,/usr' '--with-pgsql=shared,/usr/local/pgsql' '--with-openssl=/usr' '--with-gd=shared,yes' '--enable-gd-native-ttf=shared' '--with-freetype-dir=shared,/usr/local' '--with-ttf=shared,/usr/local' '--with-jpeg-dir=shared,/usr/local' '--with-png-dir=shared,/usr/local' '--with-t1lib=shared,/usr/local' '--with-zlib=/usr' '--with-zlib-dir=/usr' '--enable-ftp=shared' '--with-imap=shared,/usr/local' '--with-mcrypt=shared,/usr/local' '--with-mhash=shared,/usr/local' '--with-dom=shared,/usr/local/libxml2' '--with-dom-xslt=shared,/usr/local' '--with-dom-exslt=shared,/usr/local' '--with-mysql=shared,/usr/local/mysql' '--with-zlib-dir=/usr' but when I run a test script to see what modules are loaded I get: Array ( [0] = xml [1] = tokenizer [2] = standard [3] = session [4] = posix [5] = pcre [6] = overload [7] = openssl [8] = mbstring [9] = dio [10] = dba [11] = ctype [12] = zlib [13] = apache ) No gettext, thus Horde fails to operate. Any ideas as to what gives? I am on a virtual server running: FreeBSD 4.4-RELEASE #9: Thu Jan i386 Apache/1.3.27 PHP 4.3.0 Thanks for any help, Mark Snookal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext and translations
hi i am just reading up on gettext , it says its for translating messages , how about translating entire site content ? and a question i have been asked is how authentic is the translations ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettext and translations
Hello, electroteque [EMAIL PROTECTED] wrote: hi i am just reading up on gettext , it says its for translating messages , how about translating entire site content ? Mmm, I don't think anything like that exists--at least, not yet. There are or no sites (or software) that can perfectly translate any entire site. And, don't expect anything that would translate your entire encyclopaedia automatically as well... :) and a question i have been asked is how authentic is the translations ? Well, for gettext's translations, I believe the translators are real humans (and they're native speakers) so you can expect a high quality translation that serves its purpose... Just MHO, - E __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] gettext and translations
how does it work then ? i assumed from the description , you give it a locale and it will translate content from the database into the given language ? damn wish there was something like that -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 9:11 PM To: electroteque Cc: [EMAIL PROTECTED] Subject: Re: [PHP] gettext and translations Hello, electroteque [EMAIL PROTECTED] wrote: hi i am just reading up on gettext , it says its for translating messages , how about translating entire site content ? Mmm, I don't think anything like that exists--at least, not yet. There are or no sites (or software) that can perfectly translate any entire site. And, don't expect anything that would translate your entire encyclopaedia automatically as well... :) and a question i have been asked is how authentic is the translations ? Well, for gettext's translations, I believe the translators are real humans (and they're native speakers) so you can expect a high quality translation that serves its purpose... Just MHO, - E __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] gettext and translations
have a look at this guys http://www.translator.cx/ i'm installing it now -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 9:11 PM To: electroteque Cc: [EMAIL PROTECTED] Subject: Re: [PHP] gettext and translations Hello, electroteque [EMAIL PROTECTED] wrote: hi i am just reading up on gettext , it says its for translating messages , how about translating entire site content ? Mmm, I don't think anything like that exists--at least, not yet. There are or no sites (or software) that can perfectly translate any entire site. And, don't expect anything that would translate your entire encyclopaedia automatically as well... :) and a question i have been asked is how authentic is the translations ? Well, for gettext's translations, I believe the translators are real humans (and they're native speakers) so you can expect a high quality translation that serves its purpose... Just MHO, - E __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext issues
I am implementing gettext into a website, but for some reason, the pages keep swapping between the intended translated language (French), and the primary language (English). I'm using RedHat 7.3, with gettext-0.11.1-2 RPM. At the top of every page, I have this code: setlocale(LC_ALL, 'fr_FR'); bindtextdomain('messages', $_SERVER['DOCUMENT_ROOT'].'/locale'); textdomain('messages'); And on my testing page, I have gettext() calls surrounding any outputted text. Upon checking the returned result of setlocale, it is indeed 'fr_FR'. I have created a messages.po file (via xgettext -n *.php), and put in the translated text. I then created the messages.mo file (via msgfmt messages.po). These are both placed in the following directory: /home/web/website/locale/fr_FR/LC_MESSAGES Now, when I load up the web page, everything *should* be French. Sometimes it is. But sometimes it's English instead. It's a 50/50 thing. I've verified that the setlocale call is ALWAYS using fr_FR. Can anyone help me out? (And as an aside, can the gettext parameter span multiple lines, or must it be on one line?) -- Aaron Gould -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext
Hi I'm using gettext to add i18n to a web site, and it seems to work fine, but the translation is done randomly. I mean that if you reload many times the page, sometimes it gives back the translated message and sometimes the untranslated one. These are the steps I followed to use gettext with php: putenv(LANG=it); setlocale(LC_ALL, it); bindtextdomain(test, .); textdomain(test); print(gettext(This is a test message)); xgettext -d test test.php in the test.po file i have msgid This is a test message msgstr Questo e un messaggio di prova msgfmt - -o test.mo test.po mkdir -p it/LC_MESSAGES mv test.mo it/LC_MESSAGES The OS is FreeBSD 4.6 with apache 1.3.26 and php 4.2.1 Does anybody had the same problem? Thanks, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Gettext and PHP4.2.0?
My guess is that it's something to do with the =shared. In your phpinfo() output, there should be a table about half way down which says GetText Support enabled When I compiled (bsd so it may be different for you) I used --with-gettext=/usr/local/ the gettext binary is in /usr/local/bin and the lib is in /usr/local/lib - find out where gettext is on your setup and adjust the config option accordingly. HTH Danny. - Original Message - From: Bram van Leur [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 16, 2002 6:38 PM Subject: [PHP] Gettext and PHP4.2.0? Hi everyone, I've recently (for once in my life!) succesfully compiled PHP4.2.0 using the following configure command-line: './configure' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-regex=system' '--with-gettext=shared' '--with-zlib' '--with-gdbm' '--with-layout=GNU' '--enable-debugger' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-track-vars' '--enable-yp' '--enable-ftp' '--enable-wddx' '--without-unixODBC' '--without-oracle' '--without-oci8' '--with-mysql=/usr' '--with-gd-dir=/usr' '--with-flex' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-ttf' As you can see it contains --with-gettext so I'd expect a function like bindtextdomain() is availible. However, Horde (chora, actually) reports: Fatal error: Call to undefined function: bindtextdomain() in /home/virtual/site4/fst/var/www/html/horde/lib/Lang.php on line 91 What could have gone wrong and how can I fix it? Thanks in advance -- Bram v. Leur The Netherlands Proud to PHP! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Gettext and PHP4.2.0?
Hi everyone, I've recently (for once in my life!) succesfully compiled PHP4.2.0 using the following configure command-line: './configure' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-regex=system' '--with-gettext=shared' '--with-zlib' '--with-gdbm' '--with-layout=GNU' '--enable-debugger' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-track-vars' '--enable-yp' '--enable-ftp' '--enable-wddx' '--without-unixODBC' '--without-oracle' '--without-oci8' '--with-mysql=/usr' '--with-gd-dir=/usr' '--with-flex' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-ttf' As you can see it contains --with-gettext so I'd expect a function like bindtextdomain() is availible. However, Horde (chora, actually) reports: Fatal error: Call to undefined function: bindtextdomain() in /home/virtual/site4/fst/var/www/html/horde/lib/Lang.php on line 91 What could have gone wrong and how can I fix it? Thanks in advance -- Bram v. Leur The Netherlands Proud to PHP! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext
Hi all. Im trying to get gettext working. It is compiled in php 4.1.2 on a FreeBSD-4.5 p4 box. In the root of the webserver I have - ?php // User language here putenv(LANG=fr); putenv (LC_ALL=fr); // Specify location of translation tables bindtextdomain (messages, ./locale); // Choose domain textdomain (messages); print(_(Hello world)); ? - Directly under the root I have a directory structure as locale/en/LC_MESSAGES locale/fr/LC_MESSAGES Under locale/fr/LC_MESSAGES, I have messages.po messages.mo created from xgettext and msgfmt with 'Hello World' and the translation 'Bonjour Monde' in messages.po. For some reason or another, it won't translate to french. Anyone see anything wrong with this setup?? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext functionality needs configuration flag
Someone with the proper authority should probably put on the manual pages that to get the gettext functionality you have to configure with the --with-gettext flag. The --with-XYZ comes in almost all pages that require an additional flag, so at first I was mislead into believing it is compiled in by default. Hope I saved someone some time and the ugly Fatal error: Call to undefined function: bindtextdomain() in ... messg. cheers, --thalis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gettext()
I am interested in speaking to anyone who has used PHP's gettext() functionality on a fairly large website, preferably one that uses CVS for development. We are in the process of getting our site ready for i18n, and want to use gettext(). However, I'm a bit unsure on how to set up the file structure. Our site consists of about 400+ seperate PHP files, in about 5 levels of subdirectories. To generate and maintain one .po file for the entire site would be unmanageable I think. Ditto for maintaining 400+ .po files, one per PHP file. I'm wondering how other people have addressed this issue. Feel free to respond on- or off-list. - Colin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] gettext functions
Hy, i would like to use the gettext functions but i have no hint, where i have to put the locale files and how to tell php where they are. Is ther any sample implementation available for this? Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Gettext on Windows
Hello, Has anyone successfully implemented gettext on windows? If so how do you go about creating po files and using the bindtextdomain function; Thanks