Re: PHP extension 'gettext' doesn't work?
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.
|
|