1 / 4

Multilingual Code Localization Guide

Learn how to localize your code for different languages like Bengali (bn) using gettext functions in PHP. Initialize language, set locale, and bind text domains for seamless translation.

asleyr
Download Presentation

Multilingual Code Localization Guide

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 297, Spring’08 Prepared By: Farzana Forhad Prepared For: Dr. Chris Pollett

  2. gettext source code <?php $language = 'bn'; putenv("LANG=$language"); setlocale(LC_ALL, $language); $domain = 'messages'; bindtextdomain($domain, "\www\gettext-0.17\gettext-tools\examples\hello-php\po");//"/www/htdocs/site.com/locale"); textdomain($domain); echo _("I stood in the wind"); ?>

  3. gettext source code • $language = 'bn'; here we are initializing the language variable with the language “bn” • putenv("LANG=$language"); the function putenv() sets an environmental variable here. Put the value of $language to LANG • setlocale(LC_ALL, $language); program must initialize for a specific language, and setlcale serves the purpose

  4. gettext source code • bindtextdomain($domain, "\www\gettext-0.17\gettext-tools\examples\hello-php\po"); the full pathname for the domain currently being set • textdomain ("hello-php"); the function returns the current message domain

More Related