/functions/i18n.php

Description

SquirrelMail internationalization functions

This file contains variuos functions that are needed to do internationalization of SquirrelMail.

Internally the output character set is used. Other characters are encoded using Unicode entities according to HTML 4.0.

Includes
include_once (SM_PATH.'functions/gettext.php') (line 899)
require_once (SM_PATH.'functions/global.php') (line 23)

Everything uses global.php...

Functions
charset_convert (line 173)

Combined decoding and encoding functions

If conversion is done to charset different that utf-8, unsupported symbols will be replaced with question marks.

  • return: converted string
  • since: 1.4.4 and 1.5.1
string charset_convert (string $in_charset, string $string, string $out_charset, [boolean $htmlencode = true])
  • string $in_charset: initial charset
  • string $string: string that has to be converted
  • string $out_charset: final charset
  • boolean $htmlencode: keep htmlspecialchars encoding
charset_decode (line 86)

Converts string from given charset to charset, that can be displayed by user translation.

Function by default returns html encoded strings, if translation uses different encoding. If Japanese translation is used - function returns string converted to euc-jp If $charset is not supported - function returns unconverted string.

sanitizing of html tags is also done by this function.

  • return: decoded string
string charset_decode (string $charset, string $string, [boolean $force_decode = false], [boolean $save_html = false])
  • string $charset
  • string $string: Text to be decoded
  • boolean $force_decode: converts string to html without $charset!=$default_charset check. Argument is available since 1.5.1 and 1.4.5.
  • boolean $save_html: disables htmlspecialchars() in order to preserve html formating. Use with care. Available since 1.5.1 and 1.4.6
charset_encode (line 128)

Converts html string to given charset

  • since: 1.4.4 and 1.5.1
void charset_encode (string $string, string $charset, [boolean $htmlencode = true], string 3)
  • string $string
  • string $charset
  • boolean $htmlencode: keep htmlspecialchars encoding
  • string 3
fixcharset (line 188)

Makes charset name suitable for decoding cycles

ks_c_5601_1987, x-euc-* and x-windows-* charsets are supported since 1.5.1/1.4.6

  • return: Adjusted name of charset
  • since: 1.5.1 and 1.4.4
string fixcharset (string $charset)
  • string $charset: Name of charset
is_conversion_safe (line 393)

Function informs if it is safe to convert given charset to the one that is used by user.

It is safe to use conversion only if user uses utf-8 encoding and when converted charset is similar to the one that is used by user.

  • return: is it possible to convert to user's charset
bool is_conversion_safe (string $input_charset)
  • string $input_charset: Charset of text that needs to be converted
japanese_charset_xtra (line 471)

Japanese charset extra function

void japanese_charset_xtra ()
korean_charset_xtra (line 602)
void korean_charset_xtra ()
set_my_charset (line 364)

Sets default_charset variable according to the one that is used by user's translations.

Function changes global $default_charset variable in order to be sure, that it contains charset used by user's translation. Sanity of $squirrelmail_language and $default_charset combination provided in SquirrelMail config is also tested.

There can be a $default_charset setting in the config.php file, but the user may have a different language selected for a user interface. This function checks the language selected by the user and tags the outgoing messages with the appropriate charset corresponding to the language selection. This is "more right" (tm), than just stamping the message blindly with the system-wide $default_charset.

void set_my_charset ()
set_up_language (line 218)
void set_up_language ( $sm_language, [ $do_search = false], [ $default = false])
  • $sm_language
  • $do_search
  • $default
sq_setlocale (line 39)

php setlocale function wrapper

From php 4.3.0 it is possible to use arrays in order to set locale. php gettext extension works only when locale is set. This wrapper function allows to use more than one locale name.

string sq_setlocale (int $category, mixed $locale)
  • int $category: locale category name. Use php named constants (LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME)
  • mixed $locale: option contains array with possible locales or string with one locale

Documentation generated on Sat, 07 Oct 2006 16:31:31 +0300 by phpDocumentor 1.3.0RC6