choose_language (line 1161)
UI to choose a language.
mixed
choose_language
(tempcode $title, [boolean $tip = false])
-
tempcode
$title: Title for the form
-
boolean
$tip: Whether to give a tip about edit order
comcode_lang_string (line 1148)
Convert a language string that is Comcode to tempcode, with potential cacheing in the db.
tempcode
comcode_lang_string
(ID_TEXT $lang_code)
-
ID_TEXT
$lang_code: The language string ID
delete_lang (line 976)
Delete the specified language entry from the translation table.
void
delete_lang
(integer $id, [?object $connection = NULL])
-
integer
$id: The id
-
?object
$connection: The database connection to use (NULL: standard site connection)
does_lang_exist (line 280)
Find whether the specified language exists.
boolean
does_lang_exist
(LANGUAGE_NAME $lang)
-
LANGUAGE_NAME
$lang: The language
fallback_lang (line 165)
This function is called when no other language works, and it will return the original default language - 'EN'. You may change this to another language, but this is not advised, as ocPortal is being shipped with the EN language complete and unabridged as standard - hence you cannot go wrong if you leave it as EN.
In theory, this is the only hook to English that there is.
LANGUAGE_NAME
fallback_lang
()
find_all_langs (line 865)
Get an array of all the installed languages that can be found in root/lang/ and root/lang_custom/
array
find_all_langs
([boolean $even_empty_langs = false])
-
boolean
$even_empty_langs: Whether to even find empty languages
get_lang (line 358)
Get the current language.
First it tries to get the GET or POST language values, then it tries the user's language, then site default, then it resorts to EN.
LANGUAGE_NAME
get_lang
([?MEMBER $member = NULL])
-
?MEMBER
$member: The member id (NULL: site default language)
get_lang_browser (line 246)
Get the closest fit language code to what the browser is requesting.
?LANGUAGE_NAME
get_lang_browser
()
get_lang_forum_user (line 321)
Get what language the given member uses. The language is sent through a mapping to ensure it is in the right format, or dumped if it will not map.
?LANGUAGE_NAME
get_lang_forum_user
(MEMBER $member)
-
MEMBER
$member: The member id
get_site_default_lang (line 298)
Get the site's default language, with support for URL overrides.
LANGUAGE_NAME
get_site_default_lang
()
get_translated_tempcode (line 993)
This function is an offshoot of get_translated_text, it instead returns parsed comcode that is linked to the specified language id.
?tempcode
get_translated_tempcode
(integer $entry, [?object $connection = NULL], [?LANGUAGE_NAME $lang = NULL], [boolean $force = false], [boolean $as_admin = false], [boolean $clear_away_from_cache = false])
-
integer
$entry: The id
-
?object
$connection: The database connection to use (NULL: standard site connection)
-
?LANGUAGE_NAME
$lang: The language (NULL: uses the current language)
-
boolean
$force: Whether to force it to the specified language
-
boolean
$as_admin: Whether to force as_admin, even if the lang string isn't stored against an admin (designed for comcode page cacheing)
-
boolean
$clear_away_from_cache: Whether to remove from the Tempcode cache when we're done, for performance reasons (normally don't bother with this, but some code knows it won't be needed again -- esp Comcode cache layer -- and saves RAM by removing it)
get_translated_text (line 1087)
Try to return the human-readable version of the language id, passed in as $entry.
string
get_translated_text
(integer $entry, [?object $connection = NULL], [?LANGUAGE_NAME $lang = NULL])
-
integer
$entry: The id
-
?object
$connection: The database connection to use (NULL: standard site connection)
-
?LANGUAGE_NAME
$lang: The language (NULL: uses the current language)
init__lang (line 26)
Standard code module initialisation function.
void
init__lang
()
insert_lang (line 927)
Insert a language entry into the translation table, and returns the id.
integer
insert_lang
(string $text, integer $level, [?object $connection = NULL], [boolean $comcode = false], [?integer $id = NULL], [?LANGUAGE_NAME $lang = NULL], [boolean $insert_as_admin = false], [?string $pass_id = NULL], [?string $text2 = NULL], [integer $wrap_pos = 60], [boolean $preparse_mode = true], [boolean $save_as_volatile = false])
-
string
$text: The text
-
integer
$level: The level of importance this language string holds
-
?object
$connection: The database connection to use (NULL: standard site connection)
-
boolean
$comcode: Whether it is to be parsed as comcode
-
?integer
$id: The id to use for the language entry (NULL: work out next available)
-
?LANGUAGE_NAME
$lang: The language (NULL: uses the current language)
-
boolean
$insert_as_admin: Whether to insert it as an admin (any comcode parsing will be carried out with admin privileges)
-
?string
$pass_id: The special identifier for this lang code on the page it will be displayed on; this is used to provide an explicit binding between languaged elements and greater templated areas (NULL: none)
-
?string
$text2: Assembled Tempcode portion (NULL: work it out)
-
integer
$wrap_pos: Comcode parser wrap position
-
boolean
$preparse_mode: Whether to generate a fatal error if there is invalid Comcode
-
boolean
$save_as_volatile: Whether we are saving as a 'volatile' file extension (used in the XML DB driver, to mark things as being non-syndicated to subversion)
insert_lang_comcode (line 902)
Insert a comcode language entry into the translation table, and returns the id.
integer
insert_lang_comcode
(string $text, integer $level, [?object $connection = NULL], [boolean $insert_as_admin = false], [?string $pass_id = NULL], [integer $wrap_pos = 60], [boolean $preparse_mode = true], [boolean $save_as_volatile = false])
-
string
$text: The text
-
integer
$level: The level of importance this language string holds
-
?object
$connection: The database connection to use (NULL: standard site connection)
-
boolean
$insert_as_admin: Whether to insert it as an admin (any comcode parsing will be carried out with admin privileges)
-
?string
$pass_id: The special identifier for this lang code on the page it will be displayed on; this is used to provide an explicit binding between languaged elements and greater templated areas (NULL: none)
-
integer
$wrap_pos: Comcode parser wrap position
-
boolean
$preparse_mode: Whether to generate a fatal error if there is invalid Comcode
-
boolean
$save_as_volatile: Whether we are saving as a 'volatile' file extension (used in the XML DB driver, to mark things as being non-syndicated to subversion)
lang_code_to_default_content (line 558)
Convert the specified language codename to the default content, and return the language key.
integer
lang_code_to_default_content
(ID_TEXT $code, [boolean $comcode = false], [integer $level = 2])
-
ID_TEXT
$code: The language codename
-
boolean
$comcode: Whether the given codes value is to be parsed as comcode
-
integer
$level: The level of importance this language string holds
lang_remap (line 964)
Remap the specified language id, and return the id again - the id isn't changed.
integer
lang_remap
(integer $id, string $text, [?object $connection = NULL], [boolean $comcode = false], [?string $pass_id = NULL], [?MEMBER $source_member = NULL], [boolean $as_admin = false], [boolean $backup_string = false])
-
integer
$id: The language entries id
-
string
$text: The text to remap to
-
?object
$connection: The database connection to use (NULL: standard site connection)
-
boolean
$comcode: Whether it is to be parsed as comcode
-
?string
$pass_id: The special identifier for this lang code on the page it will be displayed on; this is used to provide an explicit binding between languaged elements and greater templated areas (NULL: none)
-
?MEMBER
$source_member: The member performing the change (NULL: current member)
-
boolean
$as_admin: Whether to generate Comcode as arbitrary admin
-
boolean
$backup_string: Whether to backup the language string before changing it
lang_remap_comcode (line 944)
Remap the specified comcode language id, and return the id again - the id isn't changed.
integer
lang_remap_comcode
(integer $id, string $text, [?object $connection = NULL], [?string $pass_id = NULL], [?MEMBER $source_member = NULL], [boolean $as_admin = false])
-
integer
$id: The language entries id
-
string
$text: The text to remap to
-
?object
$connection: The database connection to use (NULL: standard site connection)
-
?string
$pass_id: The special identifier for this lang code on the page it will be displayed on; this is used to provide an explicit binding between languaged elements and greater templated areas (NULL: none)
-
?MEMBER
$source_member: The member performing the change (NULL: current member)
-
boolean
$as_admin: Whether to generate Comcode as arbitrary admin
nice_get_langs (line 878)
Get a nice formatted XHTML listed language selector.
tempcode
nice_get_langs
([?LANGUAGE_NAME $select_lang = NULL], [boolean $show_unset = false])
-
?LANGUAGE_NAME
$select_lang: The language to have selected by default (NULL: uses the current language)
-
boolean
$show_unset: Whether to show languages that have no language details currently defined for them
protect_from_escaping (line 608)
Stop some text being escapable by the Tempcode layer.
tempcode
protect_from_escaping
(mixed $in)
require_all_lang (line 530)
Include all the language files for use in the script.
NOTE: This may reduce performance, so you should only use it if you really have to.
void
require_all_lang
([?LANGUAGE_NAME $lang = NULL])
-
?LANGUAGE_NAME
$lang: The language to include files from (NULL: use current users language). Parameter currently unused.
require_all_open_lang_files (line 578)
Require all the open language files. This doesn't hurt performance.
void
require_all_open_lang_files
([?LANGUAGE_NAME $lang = NULL])
-
?LANGUAGE_NAME
$lang: The language to require open files from (NULL: uses the current language)
require_lang (line 380)
Includes a language file for use in the script.
If $type is not null, then this specifies whether to use 'lang_custom' or 'custom' (otherwise, normal priorities occur).
void
require_lang
(ID_TEXT $codename, [?LANGUAGE_NAME $lang = NULL], [?string $type = NULL])
-
ID_TEXT
$codename: The language file name
-
?LANGUAGE_NAME
$lang: The language (NULL: uses the current language)
-
?string
$type: The language type (lang_custom, or custom) (NULL: normal priorities are used)
urlise_lang (line 596)
URL'ise specially encoded text-acceptance language strings.
tempcode
urlise_lang
(string $string, mixed $url, [string $title = ''], [boolean $new_window = false])
-
string
$string: The language string
-
mixed
$url: The URL (either tempcode or string)
-
string
$title: The title of the hyperlink
-
boolean
$new_window: Whether to use a new window
user_lang (line 175)
Get the user's currently selected language.
LANGUAGE_NAME
user_lang
()
_do_lang (line 624)
Get the human-readable form of a language id, or a language entry from a language INI file.
?mixed
_do_lang
(ID_TEXT $codename, [?mixed $token1 = NULL], [?mixed $token2 = NULL], [?mixed $token3 = NULL], [?LANGUAGE_NAME $lang = NULL], [boolean $require_result = true])
-
ID_TEXT
$codename: The language id
-
?mixed
$token1: The first token [string or tempcode] (replaces {1}) (NULL: none)
-
?mixed
$token2: The second token [string or tempcode] (replaces {2}) (NULL: none)
-
?mixed
$token3: The third token (replaces {3}). May be an array of [of string], to allow any number of additional args (NULL: none)
-
?LANGUAGE_NAME
$lang: The language to use (NULL: users language)
-
boolean
$require_result: Whether to cause ocPortal to exit if the lookup does not succeed