b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.10) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Procedural File: _locale.funcs.php

Source Location: /blogs/inc/MODEL/settings/_locale.funcs.php

Page Details

This file implements functions for handling locales and i18n.

This file is part of the evoCore framework - http://evocore.net/ See also http://sourceforge.net/projects/evocms/.

Author:  fplanque: Francois PLANQUE.
Author:  blueyed: Daniel HAHLER.
Version:  $Id: _locale.funcs.php,v 1.15.2.9.2.2 2008/03/06 22:49:52 blueyed Exp $
Copyright:  

(c)2003-2007 by Francois PLANQUE - http://fplanque.net/ Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - http://thequod.de/contact.

Todo:  Make it a class / global object!
  • Provide (static) functions to extract .po files / generate _global.php files (single quoted strings!)
Filesource:  Source Code for this file
Functions
can_convert_charsets  [line 822]

boolean can_convert_charsets( string $dest_charset, string $src_charset  )

Can we convert from charset A to charset B?

Parameters:
string   $dest_charset:  Target charset (TO)
string   $src_charset:  Source charset (FROM)


[ Top ]
convert_charset  [line 800]

string convert_charset( string $string, string $dest_charset, string $src_charset  )

Convert a string from one charset to another.

Parameters:
string   $string:  String to convert
string   $dest_charset:  Target charset (TO)
string   $src_charset:  Source charset (FROM)

API Tags:
Return:  Encoded string (if it cannot be converted it's the original one)
See:  can_convert_charsets()

Information Tags:
Todo:  Implement iconv and PHP mapping tables

[ Top ]
init_charsets  [line 857]

boolean init_charsets( string $req_io_charset  )

Init charset handling between Input/Output ($io_charset) and the internal handling ($evo_charset).

Check and possibly adjust $evo_charset.

Parameters:
string   $req_io_charset:  I/O (input/output) charset to use

API Tags:
Return:  true, if encoding has been changed
Staticvar:  boolean $trans: Used to only start mb_output_handler once


[ Top ]
locale_activate  [line 266]

void locale_activate( string $locale, boolean 1  )

Activate a locale.

Parameters:
boolean   1:  True on success/change, false on failure (if already set or not existant)
string   $locale:  locale to activate

Information Tags:
Todo:  dh> this should make sure, that e.g. "charset" is set for the locale in $locales. See http://forums.b2evolution.net/viewtopic.php?p=43980#43980

[ Top ]
locale_by_lang  [line 331]

void locale_by_lang( $lang, [ $fallback_to_default = true]  )

locale_by_lang(-)

Find first locale matching lang

Parameters:
   $lang: 
   $fallback_to_default: 


[ Top ]
locale_charset  [line 371]

void locale_charset( [ $disp = true]  )

Returns the charset of the current locale

Parameters:
   $disp: 


[ Top ]
locale_country  [line 424]

string locale_country( [string $locale = '']  )

Get the country locale

Parameters:
string   $locale:  locale to use, '' for current

API Tags:
Return:  country locale


[ Top ]
locale_datefmt  [line 385]

void locale_datefmt( )

Returns the current locale's default date format



[ Top ]
locale_dialing_code  [line 437]

void locale_dialing_code( [ $locale = '']  )

Get the locale country dialing code

Parameters:
   $locale: 


[ Top ]
locale_flag  [line 462]

void locale_flag( [string $locale = ''], [string $collection = 'w16px'], [string $class = 'flag'], [string $align = ''], [boolean $disp = true], [mixed $absoluteurl = true]  )

Template function: Display locale flag

Parameters:
string   $locale:  locale to use, '' for current
string   $collection:  collection name (subdir of img/flags)
string   $class:  name of class for IMG tag
string   $align:  deprecated HTML align attribute
boolean   $disp:  to echo or not
mixed   $absoluteurl:  use absolute url (===true) or path to flags directory


[ Top ]
locale_from_httpaccept  [line 557]

locale locale_from_httpaccept( )

Detect language from HTTP_ACCEPT_LANGUAGE

First matched full locale code in HTTP_ACCEPT_LANGUAGE will win Otherwise, first locale in table matching a lang code will win


API Tags:
Return:  made out of HTTP_ACCEPT_LANGUAGE or $default_locale, if no match


[ Top ]
locale_lang  [line 357]

string locale_lang( [boolean $disp = true]  )

Displays/Returns the current locale. (for backward compatibility)

Parameters:
boolean   $disp:  true (default) if we want it to be outputted

API Tags:
Return:  current locale, if $disp = false


[ Top ]
locale_options  [line 506]

void locale_options( [string $default = ''], [boolean $disp = true]  )

[callback function] Outputs an <option> set with default locale selected

Parameters:
string   $default:  default value
boolean   $disp:  echo output?


[ Top ]
locale_options_return  [line 542]

void locale_options_return( [string $default = '']  )

[callback function] Returns an <option> set with default locale selected

Parameters:
string   $default:  default value


[ Top ]
locale_overwritefromDB  [line 638]

mixed locale_overwritefromDB( )

load locales from DB into $locales array. Also sets $default_locale.


API Tags:
Return:  new default locale on succes, false on failure


[ Top ]
locale_priosort  [line 627]

void locale_priosort( $a, $b  )

user sort function to sort locales by priority

  1. is highest priority.

Parameters:
   $a: 
   $b: 


[ Top ]
locale_restore_previous  [line 245]

boolean locale_restore_previous( )

Restore the locale in use before the switch


API Tags:
Return:  true on success, false on failure (no locale stored before)
See:  locale_temp_switch()


[ Top ]
locale_startofweek  [line 409]

integer locale_startofweek( )

Returns the current locale's start of week


API Tags:
Return:  0 for Sunday, 1 for Monday


[ Top ]
locale_temp_switch  [line 220]

boolean locale_temp_switch( string $locale  )

Temporarily switch to another locale

Calls can be nested, see locale_restore_previous().

Parameters:
string   $locale:  locale to activate

API Tags:
Return:  true on success, false on failure


[ Top ]
locale_timefmt  [line 396]

void locale_timefmt( )

Returns the current locale's default time format



[ Top ]
locale_updateDB  [line 723]

void locale_updateDB( )

Write $locales array to DB table



[ Top ]
TS_  [line 206]

string TS_( string $string, [string $req_locale = '']  )

Translate and escape single quotes.

This is to be used mainly for Javascript stings.

Parameters:
string   $string:  String to translate
string   $req_locale:  Locale to use

API Tags:
Uses:  T_()


[ Top ]
T_  [line 52]

void T_( string $string, [string $req_locale = '']  )

TRANSLATE!

Translate a text to the desired locale (b2evo localization only) or to the current locale

Parameters:
string   $string:  String to translate, '' to get language file info (as in gettext spec)
string   $req_locale:  locale to translate to, '' to use current locale (basic gettext does only support '')

API Tags:
Usedby:  TS_()


[ Top ]


Documentation generated on Tue, 20 May 2008 01:42:34 +0200 by phpDocumentor 1.4.2