Date
1 - 18 of 18
PHP extension 'gettext' doesn't work?
Hiroaki Ukaji <dt3snow.w@...>
Hi.
We deployed a php application using 'gettext' extension to manage i18n function. (*1) We tried to activate i18n, however, it didn't work in this php application after all. We also tested with a simple application which contains 'gettext', but it seemed that the extension still doesn't work.(*2) Is there anyone who uses i18n well by using 'gettext' extension in PHP applications? ---------- (*1) http://blog.cloudfoundry.gr.jp/2015/09/cf100apps-067-fc2blog.html ---------- (*2) This result should be `/home/vcap/app/htdocs/locale: Hello, world` , if 'gettext' extension works well. ---------- Thanks. Hiroaki UKAJI -- View this message in context: http://cf-dev.70369.x6.nabble.com/cf-dev-PHP-extension-gettext-doesn-t-work-tp1984.html Sent from the CF Dev mailing list archive at Nabble.com. |
|
Daniel Mikusa
It seems to be working for me [1] (at least the extension is loading, which
toggle quoted message
Show quoted text
usually means it'll work). Can you provide some details on what you're seeing? - what version of PHP are you using? - how are you enabling the extension: options.json or composer.json? - what's the full output of `cf push`? - what's the output of `cf logs` when you try to access a page that uses `gettext`? Thanks, Dan [1] - http://php-info.cfapps.io/info.php On Tue, Sep 29, 2015 at 3:56 AM, Hiroaki Ukaji <dt3snow.w(a)gmail.com> wrote:
Hi. |
|
Hiroaki Ukaji <dt3snow.w@...>
Hi.
Thanks for your reply. Yes, I also think the extension is loading in application container, however, the function (which was able to be activated properly in a local machine) perhaps doesn't work. Anyway, I'm sorry about my less information. I'm trying to write details again. - what version of PHP are you using? >>> we're using PHP-5.5.23 (php-buildpack version is v3.2.1, which is default in cf-release v211. we're operating them on bosh-lite (tree:552dc68696), and using cf-cli v6.12.0.). - how are you enabling the extension: options.json or composer.json? >>> by "PHP_EXTENSION" in .bp-config/options.json. - what's the full output of `cf push`? - what's the output of `cf logs` when you try to access a page that uses `gettext`? >>> please observe the following. ********** `cf push` ********** $ git clone https://github.com/nota-ja/php-gettext-example $ cd php-gettext-example/ php-gettext-example$ cf push php-gettext-example Creating app php-gettext-example in org ukaji / space default as ukaji... OK Creating route php-gettext-example.10.244.0.34.xip.io... OK Binding php-gettext-example.10.244.0.34.xip.io to php-gettext-example... OK Uploading php-gettext-example... Uploading app files from: /home/ukaji/workspace/php-gettext-example Uploading 2.8K, 9 files Done uploading OK Starting app php-gettext-example in org ukaji / space default as ukaji... -----> Downloaded app package (4.0K) -------> Buildpack version 3.2.1 Installing HTTPD % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1534k 100 1534k 0 0 226M 0 --:--:-- --:--:-- --:--:-- 226M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 14682 100 14682 0 0 127M 0 --:--:-- --:--:-- --:--:-- 127M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_unixd-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 19969 100 19969 0 0 247M 0 --:--:-- --:--:-- --:--:-- 247M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_setenvif-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 137k 100 137k 0 0 514M 0 --:--:-- --:--:-- --:--:-- 514M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_proxy-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16787 100 16787 0 0 70.5M 0 --:--:-- --:--:-- --:--:-- 70.5M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_dir-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 20550 100 20550 0 0 153M 0 --:--:-- --:--:-- --:--:-- 153M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_reqtimeout-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 42000 100 42000 0 0 157M 0 --:--:-- --:--:-- --:--:-- 157M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_log_config-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 28927 100 28927 0 0 153M 0 --:--:-- --:--:-- --:--:-- 153M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_authz_core-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 25276 100 25276 0 0 197M 0 --:--:-- --:--:-- --:--:-- 197M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_mime-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 31561 100 31561 0 0 202M 0 --:--:-- --:--:-- --:--:-- 202M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_proxy_fcgi-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 17805 100 17805 0 0 106M 0 --:--:-- --:--:-- --:--:-- 106M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_remoteip-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 13323 100 13323 0 0 186M 0 --:--:-- --:--:-- --:--:-- 186M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_env-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 72297 100 72297 0 0 341M 0 --:--:-- --:--:-- --:--:-- 341M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_mpm_event-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 82878 100 82878 0 0 429M 0 --:--:-- --:--:-- --:--:-- 429M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_rewrite-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16145 100 16145 0 0 57.4M 0 --:--:-- --:--:-- --:--:-- 57.4M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_authz_host-2.4.12.tar.gz] to [/tmp] Installing PHP PHP 5.5.23 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5000k 100 5000k 0 0 449M 0 --:--:-- --:--:-- --:--:-- 449M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/php/5.5.23/php-5.5.23.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 8640k 100 8640k 0 0 341M 0 --:--:-- --:--:-- --:--:-- 341M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/php/5.5.23/php-fpm-5.5.23.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 18857 100 18857 0 0 105M 0 --:--:-- --:--:-- --:--:-- 105M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/php/5.5.23/php-gettext-5.5.23.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1046k 100 1046k 0 0 297M 0 --:--:-- --:--:-- --:--:-- 427M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/php/5.5.23/php-mbstring-5.5.23.tar.gz] to [/tmp] Finished: [2015-09-30 02:14:06.118672] -----> Uploading droplet (17M) 1 of 1 instances running App started OK App php-gettext-example was started using this command `$HOME/.bp/bin/start` Showing health and status for app php-gettext-example in org ukaji / space default as ukaji... OK requested state: started instances: 1/1 usage: 256M x 1 instances urls: php-gettext-example.10.244.0.34.xip.io last uploaded: Wed Sep 30 02:13:59 UTC 2015 stack: cflinuxfs2 buildpack: PHP state since cpu memory disk details #0 running 2015-09-30 11:14:12 AM 0.0% 22.6M of 256M 0 of 1G php-gettext-example$ curl php-gettext-example.10.244.0.34.xip.io /home/vcap/app/htdocs/locale: hello-world ******************** ********** `cf logs` when I access a page ********** curl 2015-09-30T11:15:28.79+0900 [RTR/0] OUT php-gettext-example.10.244.0.34.xip.io - [30/09/2015:02:15:28 +0000] "GET / HTTP/1.1" 200 0 46 "-" "curl/7.35.0" 10.0.2.15:56004 x_forwarded_for:"192.168.50.1, 10.0.2.15" vcap_request_id:62553a95-d90f-462c-5059-5f66ea826e70 response_time:0.007372778 app_id:d3ec3374-9460-4206-b2e0-159ce37686a8 2015-09-30T11:15:28.79+0900 [App/0] OUT 02:15:28 httpd | 192.168.50.1 - - [30/Sep/2015:02:15:28 +0000] "GET / HTTP/1.1" 200 46 vcap_request_id=62553a95-d90f-462c-5059-5f66ea826e70 peer_addr=10.0.2.15 accessing from a browser(google chrome) 2015-09-30T11:16:40.76+0900 [RTR/0] OUT php-gettext-example.10.244.0.34.xip.io - [30/09/2015:02:16:40 +0000] "GET / HTTP/1.1" 200 0 46 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.42 Safari/537.36" 10.0.2.15:56760 x_forwarded_for:"192.168.50.1, 10.0.2.15" vcap_request_id:96c67b24-dfb1-4dfe-7b23-e850ccc75e4b response_time:0.008837383 app_id:d3ec3374-9460-4206-b2e0-159ce37686a8 2015-09-30T11:16:40.78+0900 [App/0] OUT 02:16:40 httpd | 192.168.50.1 - - [30/Sep/2015:02:16:40 +0000] "GET / HTTP/1.1" 200 46 vcap_request_id=96c67b24-dfb1-4dfe-7b23-e850ccc75e4b peer_addr=10.0.2.15 2015-09-30T11:16:40.87+0900 [RTR/0] OUT php-gettext-example.10.244.0.34.xip.io - [30/09/2015:02:16:40 +0000] "GET /favicon.ico HTTP/1.1" 404 0 209 "http://php-gettext-example.10.244.0.34.xip.io/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.42 Safari/537.36" 10.0.2.15:56760 x_forwarded_for:"192.168.50.1, 10.0.2.15" vcap_request_id:34075545-f921-4597-6564-9249f7586a1b response_time:0.004353567 app_id:d3ec3374-9460-4206-b2e0-159ce37686a8 2015-09-30T11:16:40.88+0900 [App/0] OUT 02:16:40 httpd | [Wed Sep 30 02:16:40.873592 2015] [core:info] [pid 46:tid 139946828056320] [client 192.168.50.1:41285] AH00128: File does not exist: /home/vcap/app/htdocs/favicon.ico, referer: http://php-gettext-example.10.244.0.34.xip.io/ 2015-09-30T11:16:40.88+0900 [App/0] OUT 02:16:40 httpd | 192.168.50.1 - - [30/Sep/2015:02:16:40 +0000] "GET /favicon.ico HTTP/1.1" 404 209 vcap_request_id=34075545-f921-4597-6564-9249f7586a1b peer_addr=10.0.2.15 ******************** I hope these answer your questions. Thanks. Hiroaki UKAJI -- View this message in context: http://cf-dev.70369.x6.nabble.com/cf-dev-PHP-extension-gettext-doesn-t-work-tp1984p2000.html Sent from the CF Dev mailing list archive at Nabble.com. |
|
Daniel Mikusa
This looks OK. I'm not seeing any build pack errors. Could you include
your sample PHP code? See comments inline below. On Wed, Sep 30, 2015 at 1:44 AM, Hiroaki Ukaji <dt3snow.w(a)gmail.com> wrote: Hi.Could you try with the latest build pack? That would rule out any issues that have been already addressed. OK - what's the full output of `cf push`?<snip/> Installing PHPOK, so the extension is being installed. That's good. to [/tmp]The app is starting OK, that's good. OK /home/vcap/app/htdocs/locale: hello-worldSo, I take it "hello-world" should be replaced with a localized version? ********************I don't see any errors in the logs, so that's good. If the extension failed to load, it should show up here. Dan curl |
|
Hiroaki Ukaji <dt3snow.w@...>
Hi.
Thanks a lot for your detailed checks and comments. Could you include your sample PHP code? Could you try with the latest build pack? That would rule out any issues that have been already addressed. So, I take it "hello-world" should be replaced with a localized version?Yes, I'll show my sample code and its results. Please see the following. It is true that PHP extension 'gettext' is being installed correctly,Yes, I think it should be replaced the other word written in but perhaps it seemed that 'gettext' function doesn't work well. ********** my sample source code ********** URL: https://github.com/hiroakiukaji/php-gettext-test $ tree . ├── index.php └── locale └── ja_JP.UTF-8 └── LC_MESSAGES ├── messages.mo └── messages.po $ vi index.php <?php $lang = "ja_JP.UTF-8"; $domain = "messages"; setlocale(LC_ALL, $lang); bindtextdomain($domain, "./locale/"); textdomain($domain); // message echo _("hello world"); $ vi locale/ja_JP.UTF-8/LC_MESSAGES/messages.po # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL(a)ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-09-29 09:47+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL(a)ADDRESS>\n" "Language-Team: LANGUAGE <LL(a)li.org>\n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: index.php:7 msgid "hello world" msgstr "konnnichiwa sekai" ******************** When we operate the above codes in my local machine, we get following result. ********** result with my local machine (apache2+php5.5.29 on Ubuntu14.04)********** $ curl 127.0.0.1:80 konnnichiwa sekai ******************** In my local environment, the message "hello world" is translated into japanese sentence, "konnnichiwa sekai". The results on cloud foundry with 'latest' buildpack is as follows. (php-buildpack v4.1.4 / cf-release v211 / bosh-lite #552dc68696 / cf-cli v6.12.0) ********** full output of `cf push` (latest buildpack) ********** $ cf push php-get-test-v4.1.4 -b https://github.com/cloudfoundry/php-buildpack Creating app php-get-test-v4.1.4 in org ukaji / space default as ukaji... OK Creating route php-get-test-v414.10.244.0.34.xip.io... OK Binding php-get-test-v414.10.244.0.34.xip.io to php-get-test-v4.1.4... OK Uploading php-get-test-v4.1.4... Uploading app files from: /home/ukaji/php-gettext-test Uploading 2.4K, 8 files Done uploading OK Starting app php-get-test-v4.1.4 in org ukaji / space default as ukaji... -----> Downloaded app package (4.0K) Cloning into '/tmp/buildpacks/php-buildpack'... Submodule 'compile-extensions' (https://github.com/cloudfoundry/compile-extensions) registered for path 'compile-extensions' Cloning into 'compile-extensions'... Submodule path 'compile-extensions': checked out '450ef697e1ea234add05121fbeb5d05b056133c6' -------> Buildpack version 4.1.4 Installing HTTPD Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/concourse-binaries/httpd/httpd-2.4.16-linux-x64.tgz] to [/tmp] Installing PHP PHP 5.5.29 Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/concourse-binaries/php/php-5.5.29-linux-x64-1442441030.tgz] to [/tmp] Finished: [2015-10-01 06:09:34.369789] -----> Uploading droplet (41M) 1 of 1 instances running App started OK App php-get-test-v4.1.4 was started using this command `$HOME/.bp/bin/start` Showing health and status for app php-get-test-v4.1.4 in org ukaji / space default as ukaji... OK requested state: started instances: 1/1 usage: 256M x 1 instances urls: php-get-test-v414.10.244.0.34.xip.io last uploaded: Thu Oct 1 06:08:49 UTC 2015 stack: cflinuxfs2 buildpack: https://github.com/cloudfoundry/php-buildpack state since cpu memory disk details #0 running 2015-10-01 03:09:48 PM 0.0% 53.6M of 256M 0 of 1G ******************** ********** result (latest buildpack) ********** $ curl php-get-test-v414.10.244.0.34.xip.io hello world ******************** ********** `cf logs` when I access a page (latest buildpack) ********** 2015-10-01T15:12:19.33+0900 [RTR/0] OUT php-get-test-v414.10.244.0.34.xip.io - [01/10/2015:06:12:19 +0000] "GET / HTTP/1.1" 200 0 11 "-" "curl/7.35.0" 10.0.2.15:42716 x_forwarded_for:"192.168.50.1, 10.0.2.15" vcap_request_id:1ae938d2-0d2c-45b7-4bd5-cfbbccb721e3 response_time:0.007400870 app_id:917e3e17-a77e-4b67-8776-bd0f938132f5 2015-10-01T15:12:19.35+0900 [App/0] OUT 06:12:19 httpd | 192.168.50.1 - - [01/Oct/2015:06:12:19 +0000] "GET / HTTP/1.1" 200 11 vcap_request_id=1ae938d2-0d2c-45b7-4bd5-cfbbccb721e3 peer_addr=10.0.2.15 ******************** The results on cloud foundry with 'v211 default' buildpack is as follows. (php-buildpack v3.2.1 / cf-release v211 / bosh-lite #552dc68696 / cf-cli v6.12.0) ********** full output of `cf push` (cf v211 default buildpack) ********** $ cf push php-get-test-v3.2.1 Creating app php-get-test-v3.2.1 in org ukaji / space default as ukaji... OK Creating route php-get-test-v321.10.244.0.34.xip.io... OK Binding php-get-test-v321.10.244.0.34.xip.io to php-get-test-v3.2.1... OK Uploading php-get-test-v3.2.1... Uploading app files from: /home/ukaji/php-gettext-test Uploading 2.4K, 8 files Done uploading OK Starting app php-get-test-v3.2.1 in org ukaji / space default as ukaji... -----> Downloaded app package (4.0K) -------> Buildpack version 3.2.1 Installing HTTPD % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1534k 100 1534k 0 0 340M 0 --:--:-- --:--:-- --:--:-- 340M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 14682 100 14682 0 0 106M 0 --:--:-- --:--:-- --:--:-- 106M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_unixd-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 19969 100 19969 0 0 264M 0 --:--:-- --:--:-- --:--:-- 264M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_setenvif-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 137k 100 137k 0 0 243M 0 --:--:-- --:--:-- --:--:-- 243M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_proxy-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16787 100 16787 0 0 181M 0 --:--:-- --:--:-- --:--:-- 181M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_dir-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 20550 100 20550 0 0 222M 0 --:--:-- --:--:-- --:--:-- 222M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_reqtimeout-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 42000 100 42000 0 0 90.0M 0 --:--:-- --:--:-- --:--:-- 90.0M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_log_config-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 28927 100 28927 0 0 125M 0 --:--:-- --:--:-- --:--:-- 125M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_authz_core-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 25276 100 25276 0 0 68.0M 0 --:--:-- --:--:-- --:--:-- 68.0M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_mime-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 31561 100 31561 0 0 136M 0 --:--:-- --:--:-- --:--:-- 136M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_proxy_fcgi-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 17805 100 17805 0 0 95.9M 0 --:--:-- --:--:-- --:--:-- 95.9M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_remoteip-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 13323 100 13323 0 0 98.4M 0 --:--:-- --:--:-- --:--:-- 98.4M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_env-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 72297 100 72297 0 0 325M 0 --:--:-- --:--:-- --:--:-- 325M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_mpm_event-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 82878 100 82878 0 0 367M 0 --:--:-- --:--:-- --:--:-- 367M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_rewrite-2.4.12.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16145 100 16145 0 0 112M 0 --:--:-- --:--:-- --:--:-- 112M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/httpd/2.4.12/httpd-mod_authz_host-2.4.12.tar.gz] to [/tmp] Installing PHP PHP 5.5.23 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5000k 100 5000k 0 0 490M 0 --:--:-- --:--:-- --:--:-- 490M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/php/5.5.23/php-5.5.23.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 8640k 100 8640k 0 0 549M 0 --:--:-- --:--:-- --:--:-- 549M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/php/5.5.23/php-fpm-5.5.23.tar.gz] to [/tmp] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 18857 100 18857 0 0 224M 0 --:--:-- --:--:-- --:--:-- 224M Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/php/binaries/trusty/php/5.5.23/php-gettext-5.5.23.tar.gz] to [/tmp] Finished: [2015-10-01 06:00:02.620608] -----> Uploading droplet (16M) 1 of 1 instances running App started OK App php-get-test-v3.2.1 was started using this command `$HOME/.bp/bin/start` Showing health and status for app php-get-test-v3.2.1 in org ukaji / space default as ukaji... OK requested state: started instances: 1/1 usage: 256M x 1 instances urls: php-get-test-v321.10.244.0.34.xip.io last uploaded: Thu Oct 1 05:59:53 UTC 2015 stack: cflinuxfs2 buildpack: PHP state since cpu memory disk details #0 running 2015-10-01 03:00:12 PM 0.0% 26.7M of 256M 0 of 1G ******************** ********** result (cf v211 default buildpack) ********** $ curl php-get-test-v321.10.244.0.34.xip.io hello world ******************** ********** `cf logs` when I access a page (cf v211 default buildpack) ********** 2015-10-01T15:05:31.87+0900 [RTR/0] OUT php-get-test-v321.10.244.0.34.xip.io - [01/10/2015:06:05:31 +0000] "GET / HTTP/1.1" 200 0 11 "-" "curl/7.35.0" 10.0.2.15:38404 x_forwarded_for:"192.168.50.1, 10.0.2.15" vcap_request_id:426677e4-e17f-4e0e-5142-75700cd9a33b response_time:0.003993564 app_id:471f624e-fe67-458e-b788-f131aa271650 2015-10-01T15:05:31.88+0900 [App/0] OUT 06:05:31 httpd | 192.168.50.1 - - [01/Oct/2015:06:05:31 +0000] "GET / HTTP/1.1" 200 11 vcap_request_id=426677e4-e17f-4e0e-5142-75700cd9a33b peer_addr=10.0.2.15 ******************** Thanks. Hiroaki UKAJI -- View this message in context: http://cf-dev.70369.x6.nabble.com/cf-dev-PHP-extension-gettext-doesn-t-work-tp1984p2027.html Sent from the CF Dev mailing list archive at Nabble.com. |
|
Daniel Mikusa
Thanks! See comment inline...
On Thu, Oct 1, 2015 at 2:21 AM, Hiroaki Ukaji <dt3snow.w(a)gmail.com> wrote: Hi.I think you need to additionally set an environment variable here. See this note from the PHP docs. Note: Setting a language isn't enough for some systems and the putenv() <http://php.net/manual/en/function.putenv.php> should be used to define the current locale. http://php.net/manual/en/function.gettext.php and the first comment on that page. ex: putenv("LC_ALL=$lang"); setlocale(LC_ALL, $lang); Give that a try and let me know how it goes. Dan <?php
|
|
Hiroaki Ukaji <dt3snow.w@...>
Hi.
Thanks for your advice. I tried to fix my code to define the current locale by "putenv()", but I think the result wasn't still translated. I'll show the results by following. ********** source code ********** URL: https://github.com/hiroakiukaji/php-gettext-example php-gettext-example$ vi index.php <?php // I18N support information here $language = 'ja_JP.UTF-8'; putenv("LC_ALL=$lang"); setlocale(LC_ALL, $language); // Set the text domain as 'messages' $domain = 'messages'; bindtextdomain($domain, "./locale"); textdomain($domain); echo _('hello world'); ******************** ********** full output of `cf push` (buildpack: latest) ********** $ cf push php-gettext-example -b https://github.com/cloudfoundry/php-buildpack Creating app php-gettext-example in org ukaji / space default as ukaji... OK Creating route php-gettext-example.10.244.0.34.xip.io... OK Binding php-gettext-example.10.244.0.34.xip.io to php-gettext-example... OK Uploading php-gettext-example... Uploading app files from: /home/ukaji/php-gettext-example Uploading 14K, 10 files Done uploading OK Starting app php-gettext-example in org ukaji / space default as ukaji... -----> Downloaded app package (8.0K) Cloning into '/tmp/buildpacks/php-buildpack'... Submodule 'compile-extensions' (https://github.com/cloudfoundry/compile-extensions) registered for path 'compile-extensions' Cloning into 'compile-extensions'... Submodule path 'compile-extensions': checked out '450ef697e1ea234add05121fbeb5d05b056133c6' -------> Buildpack version 4.1.4 Installing HTTPD Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/concourse-binaries/httpd/httpd-2.4.16-linux-x64.tgz] to [/tmp] Installing PHP PHP 5.5.29 Downloaded [https://pivotal-buildpacks.s3.amazonaws.com/concourse-binaries/php/php-5.5.29-linux-x64-1442441030.tgz] to [/tmp] Finished: [2015-10-02 08:08:34.913180] -----> Uploading droplet (41M) 1 of 1 instances running App started OK App php-gettext-example was started using this command `$HOME/.bp/bin/start` Showing health and status for app php-gettext-example in org ukaji / space default as ukaji... OK requested state: started instances: 1/1 usage: 256M x 1 instances urls: php-gettext-example.10.244.0.34.xip.io last uploaded: Fri Oct 2 08:08:06 UTC 2015 stack: cflinuxfs2 buildpack: https://github.com/cloudfoundry/php-buildpack state since cpu memory disk details #0 running 2015-10-02 05:08:50 PM 0.0% 55.1M of 256M 0 of 1G ******************** ********** `cf logs` when I access the URL ********** 2015-10-02T17:09:24.96+0900 [RTR/0] OUT php-gettext-example.10.244.0.34.xip.io - [02/10/2015:08:09:24 +0000] "GET / HTTP/1.1" 200 0 11 "-" "curl/7.35.0" 10.0.2.15:36543 x_forwarded_for:"192.168.50.1, 10.0.2.15" vcap_request_id:028e28af-7a7d-4539-6641-a73c47cb1c2e response_time:0.008358312 app_id:258ec6ea-ab04-477d-9a80-b7a31ffefab8 2015-10-02T17:09:24.97+0900 [App/0] OUT 08:09:24 httpd | 192.168.50.1 - - [02/Oct/2015:08:09:24 +0000] "GET / HTTP/1.1" 200 11 vcap_request_id=028e28af-7a7d-4539-6641-a73c47cb1c2e peer_addr=10.0.2.15 ******************** If you don't mind, could you try these on pws? (When I tried, I got the same result.) Thanks. Hiroaki UKAJI -- View this message in context: http://cf-dev.70369.x6.nabble.com/cf-dev-PHP-extension-gettext-doesn-t-work-tp1984p2052.html Sent from the CF Dev mailing list archive at Nabble.com. |
|
Daniel Mikusa
Sorry for the delay on this. I took a quick look today and couldn't get
toggle quoted message
Show quoted text
your example to work. It would run OK, but the translation didn't happen. The same behavior occurred when run on CF and in an Ubuntu docker container that I setup with Apache HTTPD & PHP 5.5. I tried adjusting the example a bit, but couldn't make it work. I'll take a second look when I get some more time. Dan On Fri, Oct 2, 2015 at 4:21 AM, Hiroaki Ukaji <dt3snow.w(a)gmail.com> wrote:
|
|
Hiroaki Ukaji <dt3snow.w@...>
Hi.
Thanks for your confirmation. I'm glad that it seems like my intention is being conveyed. (I'm sorry about my poor English...) I'm looking forward to hearing a second look from you. Thanks. Hiroaki UKAJI -- View this message in context: http://cf-dev.70369.x6.nabble.com/cf-dev-PHP-extension-gettext-doesn-t-work-tp1984p2178.html Sent from the CF Dev mailing list archive at Nabble.com. |
|
Daniel Mikusa
OK, so really sorry this took me so long to investigate, but I think I've
toggle quoted message
Show quoted text
found the issue. Ubuntu has these "language packs" and in order for gettext to work the system has to have that language pack installed. https://help.ubuntu.com/community/Locale You can see what language packs are installed on your system by running `locale -a`. I was testing this on an Ubuntu docker image and the only way I could make it work was to install the language pack. As soon as I did that and restarted Apache HTTPD, I started to get my translations. Running `locale -a` on the `cflinuxfs2` docker image shows that only these language packs are installed. ``` $ locale -a C C.UTF-8 POSIX en_US.utf8 ``` When I setup a test app and run it on CF, I get the same results. Only `en_US.utf8` works. Unfortunately, I'm not sure how you could go about installing more language packs into the stack for CF. It seems that you have to install them via `apt-get` and that simply won't work, since there's no root access in the container. If anyone has any ideas about how to install more language packs, let me know. My only suggestion would be to use the intl extension instead of gettext. I believe it offers similar functionality, although it's not something I've done myself. Hope that helps! Dan On Fri, Oct 9, 2015 at 4:47 AM, Hiroaki Ukaji <dt3snow.w(a)gmail.com> wrote:
Hi. |
|
Mike Dalessio
I'm actually open to adding commonly-used locales to the rootfs; though
toggle quoted message
Show quoted text
that wouldn't help anyone until they're able to upgrade. I'd like to propose that we install the debian package `locales`, which looks like it includes support for 311 locales and 232 charmaps. It's only about 10MB installed (according to http://packages.ubuntu.com/trusty/locales ). Objections? Tracker story is here: https://www.pivotaltracker.com/story/show/106641954 On Fri, Oct 23, 2015 at 8:44 PM, Daniel Mikusa <dmikusa(a)pivotal.io> wrote:
OK, so really sorry this took me so long to investigate, but I think I've |
|
Daniel Mikusa
Mike,
toggle quoted message
Show quoted text
That sounds good. Happy to retest after that work has been done and confirm it resolves the issue here. Dan On Mon, Oct 26, 2015 at 9:11 AM, Mike Dalessio <mdalessio(a)pivotal.io> wrote:
I'm actually open to adding commonly-used locales to the rootfs; though |
|
Hiroaki Ukaji <dt3snow.w@...>
Hi.
Thanks to you, I understood why i18n by gettext didn't work on CF. Certainly, the language pack "ja_JP.utf8" only exists in my local machine.. Anyway, we're glad to hear that the debian package "locales" will be added to the rootfs. It will resolve this issue and then we will be able to manage i18n by gettext extension on CF. Thanks a lot. Hiroaki UKAJI -- View this message in context: http://cf-dev.70369.x6.nabble.com/cf-dev-PHP-extension-gettext-doesn-t-work-tp1984p2450.html Sent from the CF Dev mailing list archive at Nabble.com. |
|
I agree the inclusion of the lang pack into linuxfs2 seems best option.
toggle quoted message
Show quoted text
I'm wondering though whether a temporary workaround could be to install the "locales" debian package using apt-buildpack [1] (no sudo needed) and combine it with php buildpack using the multi buildpack [2] ? I was planning to test that for another purpose but had not the chance yet. I'm interested in hearing the outcome. Guillaume. [1] https://github.com/pivotal-cf-experimental/apt-buildpack [2] https://github.com/ddollar/heroku-buildpack-multi Le 27 oct. 2015 02:41, "Hiroaki Ukaji" <dt3snow.w(a)gmail.com> a écrit :
|
|
Mike Dalessio
Unfortunately, the apt-buildpack only works for installing staging-time
toggle quoted message
Show quoted text
dependencies, and not runtime dependencies. It could be made to work, but the core buildpacks team simply have not done so because nobody has asked (yet). ;) On Fri, Oct 30, 2015 at 1:37 PM, Guillaume Berche <bercheg(a)gmail.com> wrote:
I agree the inclusion of the lang pack into linuxfs2 seems best option. |
|
JT Archie <jarchie@...>
We've added support for some locales into the rootfs. There are quite a few
toggle quoted message
Show quoted text
locales, of which we don't know if we need to officially support them. Our current list, is from a consumer level list of *most used* locales. Please feel free to review this commit <https://github.com/cloudfoundry/stacks/commit/748cb604ef55f3eeb334d960f496661b58ec50ca>. We've made it explicit what locales are supported. With these changes, we've been able to make the PHP `gettext` extension work with the example. It has been added to our test suite <https://github.com/cloudfoundry/php-buildpack/tree/develop/cf_spec/fixtures/php_app_testing_locale> for future support. Let us know if you need anything else. Kind Regards, JT On Fri, Oct 30, 2015 at 1:41 PM, Mike Dalessio <mdalessio(a)pivotal.io> wrote:
Unfortunately, the apt-buildpack only works for installing staging-time |
|
Jack Cai
This is a great list of languages to support. May I ask to add ar (Arabic)
toggle quoted message
Show quoted text
and iw (Hebrew) to the list? These two are considered "Group 2" languages in the company I work for. With them added, all Group 1 and Group 2 languages will be included in the list, which is a confirmation that we have a good list. Jack On Mon, Nov 2, 2015 at 4:41 PM, JT Archie <jarchie(a)pivotal.io> wrote:
We've added support for some locales into the rootfs. There are quite a |
|
Mike Dalessio
Hi Jack,
toggle quoted message
Show quoted text
That sounds like a great idea. I'll prioritize this work in our Tracker backlog. -mike On Tue, Nov 3, 2015 at 2:58 PM, Jack Cai <greensight(a)gmail.com> wrote:
This is a great list of languages to support. May I ask to add ar (Arabic) |
|