Class PHPGettext

Description

Located in /includes/phpgettext/phpgettext.class.php (line 13)


	
			
Variable Summary
 mixed $charset
 mixed $debug
 mixed $domain
 mixed $has_gettext
 mixed $headers
 mixed $lang
 mixed $locale
 mixed $messages
Method Summary
 PHPGettext PHPGettext ()
 void add ( $domain)
 void bindtextdomain ( $domain,  $path)
 void bind_textdomain_codeset ( $domain,  $charset)
 void dcgettext ( $domain,  $message,  $category)
 void dcngettext ( $domain,  $msg1,  $msg2,  $count,  $category)
 void dgettext ( $domain,  $message)
 void dngettext ( $domain,  $msgid,  $msgid_plural,  $count)
 void getlocale ()
 void getplural ( $count,  $domain)
 void gettext ( $message)
 void load ( $domain,  $path)
 void ngettext ( $msgid,  $msgid_plural,  $count)
 void output ( $message, [ $untranslated = false])
 void setlocale ( $lang, [ $locale = false])
 unknown setVariable ( $variable)
 void textdomain ([ $domain = null])
 void _ ( $message, [ $output = false])
Variables
mixed $charset (line 34)

The current character set

mixed $debug (line 53)

The debugging flag

mixed $domain (line 29)

The current domain

mixed $has_gettext (line 15)
mixed $headers = array() (line 44)

The asssociative array of headers for the current domain

mixed $lang (line 20)

The current locale. eg: en-GB

mixed $locale (line 24)

The current locale. eg: en-GB

mixed $messages = array() (line 48)

The asssociative array of messages for the current domain

mixed $text_domains = array() (line 39)

Container for the loaded domains

Methods
Constructor PHPGettext (line 55)
PHPGettext PHPGettext ()
add (line 342)
void add ( $domain)
  • $domain
bindtextdomain (line 234)

Sets the path for a domain

if gettext is unavailable, translation files will be loaded here

void bindtextdomain ( $domain,  $path)
  • $domain
  • $path
bind_textdomain_codeset (line 222)

Specify the character encoding in which the messages

from the DOMAIN message catalog will be returned

void bind_textdomain_codeset ( $domain,  $charset)
  • $domain
  • $charset
dcgettext (line 275)

Overrides the domain for a single lookup This function allows you to override the current domain for a single message lookup.

It also allows you to specify a category. Categories are folders within the languages directory . currently, only LC_MESSAGES is implemented

The values for categories are: LC_CTYPE 0 LC_NUMERIC 1 LC_TIME 2 LC_COLLATE 3 LC_MONETARY 4 LC_MESSAGES 5 LC_ALL 6

not yet implemented

void dcgettext ( $domain,  $message,  $category)
  • $domain
  • $message
  • $category
dcngettext (line 283)

dcngettext -- Plural version of dcgettext

not yet implemented

void dcngettext ( $domain,  $msg1,  $msg2,  $count,  $category)
  • $domain
  • $msg1
  • $msg2
  • $count
  • $category
dgettext (line 163)

Override the current domain The dgettext() function allows you to override the current domain for a single message lookup.

void dgettext ( $domain,  $message)
  • $domain
  • $message
dngettext (line 198)

Plural version of dgettext

void dngettext ( $domain,  $msgid,  $msgid_plural,  $count)
  • $domain
  • $msgid
  • $msgid_plural
  • $count
getlocale (line 86)
void getlocale ()
getplural (line 313)

Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;

nplurals - total number of plurals plural - the plural index

Plural-Forms: nplurals=1; plural=0;

  1. form only
Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1; Plural-Forms: nplurals=2; plural=n != 1; 2 forms, singular used for one only

Plural-Forms: nplurals=2; plural=n>1; 2 forms, singular used for zero and one

Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2; 3 forms, special case for zero

Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2; 3 forms, special cases for one and two

Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3; 4 forms, special case for one and all numbers ending in 02, 03, or 04

void getplural ( $count,  $domain)
  • $count
  • $domain
gettext (line 142)

Lookup a message in the current domain

returns translation if it exists or original message

void gettext ( $message)
  • $message
load (line 330)
void load ( $domain,  $path)
  • $domain
  • $path
ngettext (line 176)

Plural version of gettext

void ngettext ( $msgid,  $msgid_plural,  $count)
  • $msgid
  • $msgid_plural
  • $count
output (line 106)

debugging function

void output ( $message, [ $untranslated = false])
  • $message
  • $untranslated
setlocale (line 75)
void setlocale ( $lang, [ $locale = false])
  • $lang
  • $locale
setVariable (line 69)

Set and lookup the locale from the environment variables.

Priority order for gettext is:

  1. LANGUAGE
  2. LC_ALL
  3. LC_MESSAGE
  4. LANG

unknown setVariable ( $variable)
  • $variable
textdomain (line 246)

Sets the default domain textdomain

void textdomain ([ $domain = null])
  • $domain
_ (line 129)

Alias for gettext

will also output the result if $output = true

void _ ( $message, [ $output = false])
  • $message
  • $output

Documentation generated on Mon, 05 May 2008 16:22:23 +0400 by phpDocumentor 1.4.0