I18Nv2
[ class tree: I18Nv2 ] [ index: I18Nv2 ] [ all elements ]

Class: I18Nv2

Source Location: /I18Nv2-0.2.0/I18Nv2.php

Class Overview


I18Nv2 - Internationalization v2


Author(s):

Version:

  • $Revision: 1.4 $

Methods


Inherited Variables

Inherited Methods


Class Details

[line 41]
I18Nv2 - Internationalization v2


[ Top ]


Method Detail

autoConv   [line 174]

mixed autoConv( [string $ocs = 'UTF-8'], [string $ics = 'ISO-8859-1'])

Automatically transform output between character sets

This method utilizes ob_iconv_handler(), so you should call it at the beginning of your script (prior to output)


1 <?php
2 require_once('I18Nv2.php');
3 I18Nv2::autoConv('iso-8859-1', 'utf-8');
4 print('...'); // some utf-8 stuff gets converted to iso-8859-1
5 // ...
6 ?>

  • Return: Returns &true; on success or <classname>PEAR_Error</classname> on failure.
  • Access: public
  • Static: This method can be called statically

Parameters:

string   $ocs     desired output character set
string   $ics     current intput character set

[ Top ]

createLocale   [line 131]

object I18Nv2_Locale &createLocale( [string $locale = null])

Create a Locale object
  • Access: public
  • Static: This method can be called statically

Parameters:

string   $locale     

[ Top ]

createNegotiator   [line 146]

object I18Nv2_Negotiator &createNegotiator( [string $defLang = 'en'], [string $defCharset = 'iso-8859-1'])

Create a Negotiator object
  • Access: public
  • Static: This method can be called statically

Parameters:

string   $defLang     default language
string   $defCharset     default character set

[ Top ]

getInfo   [line 117]

mixed getInfo( [string $part = null])

Get several locale specific information

Parameters:

string   $part     

[ Top ]

getStaticProperty   [line 252]

mixed &getStaticProperty( string $property)

Get access to static property
  • Return: Returns a reference to a static property
  • Access: public
  • Static: This method can be called statically

Parameters:

string   $property     the static property

[ Top ]

langs2locales   [line 219]

array langs2locales( array $languages)

Traverse languages to locales

Returns en_US, de_DE from en-US and de-DE

  • Access: public
  • Static: This method can be called statically

Parameters:

array   $languages     

[ Top ]

lastLocale   [line 95]

string lastLocale( [int $prior = 0], [bool $full = false])

Get current/prior Locale

This only works, if I18Nv2::setLocale() has already been called

  • Return: last locale
  • Access: public
  • Static: This method can be called statically

Parameters:

int   $prior     if 0, the current otherwise n prior current
bool   $full     wheter to return the array with locale, language and actually used system locale

[ Top ]

locales2langs   [line 204]

array locales2langs( array $locales)

Traverse locales to languages

Returns en-US, de-DE from en_US and de_DE

  • Access: public
  • Static: This method can be called statically

Parameters:

array   $locales     

[ Top ]

setLocale   [line 57]

mixed setLocale( string $locale, [int $cat = LC_ALL])

Set Locale

Example:


1 I18Nv2::setLocale('en_GB');

  • Return: &type.string; used locale or false on failure
  • Access: public
  • Static: This method can be called statically

Parameters:

string   $locale     a valid locale like en_US or de_DE
int   $cat     the locale category - usually LC_ALL

[ Top ]


Documentation generated on Sun, 16 May 2004 05:12:35 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.