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

Class: I18Nv2

Source Location: /I18Nv2-0.11.4/I18Nv2.php

Class Overview


I18Nv2 - Internationalization v2


Author(s):

Version:

  • $Revision: 1.36 $

Methods


Inherited Variables

Inherited Methods


Class Details

[line 34]
I18Nv2 - Internationalization v2
  • Author: Michael Wallner <mike@php.net>
  • Version: $Revision: 1.36 $
  • Access: public


[ Top ]


Method Detail

autoConv   [line 228]

mixed autoConv( [string $oe = 'UTF-8'], [string $ie = 'ISO-8859-1'], [bool $decodeRequest = true], [bool $refetchOB = true])

Automatically transform output between encodings

This method utilizes ob_iconv_handler(), so you should call it at the beginning of your script (prior to output). If any output buffering has been started before, the contents will be fetched with ob_get_contents() and the buffers will be destroyed by ob_end_clean() if $refetchOB is set to true.

  1.  require_once('I18Nv2.php');
  2.  I18Nv2::autoConv('CP1252');
  3.  print('...')// some iso-8859-1 stuff gets converted to Windows-1252
  4.  // ...

  • Return: Returns &true; on success or <classname>PEAR_Error</classname> on failure.
  • Access: public

Parameters:

string   $oe   —  desired output encoding
string   $ie   —  internal encoding
bool   $decodeRequest   —  whether to decode request variables ($_GET and $_POST) from $oe to $ie
bool   $refetchOB   —  whether contents of already active output buffers should be fetched, the output buffer handlers destroyed and the fetched data be passed through ob_iconvhandler

[ Top ]

countryOf   [line 368]

string countryOf( string $locale)

Get country code of locale
  • Access: public

Parameters:

string   $locale   — 

[ Top ]

createLocale   [line 174]

object I18Nv2_Locale &createLocale( [string $locale = null], [bool $paranoid = false])

Create a Locale object
  • Access: public

Parameters:

string   $locale   —  The locale to use.
bool   $paranoid   —  Whether to operate in paranoid mode.

[ Top ]

createNegotiator   [line 191]

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

Create a Negotiator object
  • Access: public

Parameters:

string   $defLang   —  default language
string   $defEnc   —  default encoding
string   $defCtry   —  default country

[ Top ]

getInfo   [line 159]

mixed getInfo( [string $part = null])

Get several locale specific information

Parameters:

string   $part   — 

[ Top ]

getStaticProperty   [line 381]

mixed &getStaticProperty( string $property)

Get access to static property
  • Return: Returns a reference to a static property
  • Access: public

Parameters:

string   $property   —  the static property

[ Top ]

l2l   [line 326]

string l2l( string $localeOrLanguage)

Locale to language or language to locale
  • Access: public

Parameters:

string   $localeOrLanguage   — 

[ Top ]

langs2locales   [line 313]

array langs2locales( array $languages)

Traverse languages to locales

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

  • Access: public

Parameters:

array   $languages   — 

[ Top ]

languageOf   [line 355]

string languageOf( $locale)

Get language code of locale
  • Access: public

Parameters:

   $locale   — 

[ Top ]

lastLocale   [line 128]

mixed lastLocale( [int $prior = 0], [bool $part = 0])

Get current/prior Locale
  • Return: last locale as string or array
  • Access: public

Parameters:

int   $prior   —  if 0, the current otherwise n prior to current
bool   $part   —  true|all|0=locale|1=language|2=syslocale

[ Top ]

locales2langs   [line 298]

array locales2langs( array $locales)

Traverse locales to languages

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

  • Access: public

Parameters:

array   $locales   — 

[ Top ]

recursiveIconv   [line 277]

void recursiveIconv( &$value, string $from, string $to, array $value)

Recursive Iconv
  • Access: public

Parameters:

array   $value   — 
string   $from   — 
string   $to   — 
   &$value   — 

[ Top ]

setLocale   [line 50]

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

Set Locale

Example:

  1.  I18Nv2::setLocale('en_GB');

  • Return: &type.string; used locale or false on failure
  • Access: public

Parameters:

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

[ Top ]

splitLocale   [line 341]

array splitLocale( string $locale)

Split locale code

Splits locale codes into its language and country part

  • Access: public

Parameters:

string   $locale   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:38:10 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.