summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-05-19 12:52:23 -0700
committerBrion Vibber <brion@pobox.com>2010-05-19 12:52:23 -0700
commitc4203be9a4e13f892fa8ea71f08477110a39dbe3 (patch)
tree34989ca973dc56d0ba5f57583ce74fde333e4341 /lib/util.php
parent91367dbc2145d0ad0eebd12cd6197d54c3d3b930 (diff)
parent7005ef66617b265ddccdd9082c2368bf014a7e83 (diff)
Merge branch '0.9.x' into 1.0.x
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/util.php b/lib/util.php
index b2717e96d..c6d8f814d 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -34,6 +34,14 @@ function common_user_error($msg, $code=400)
$err->showPage();
}
+/**
+ * This should only be used at setup; processes switching languages
+ * to send text to other users should use common_switch_locale().
+ *
+ * @param string $language Locale language code (optional; empty uses
+ * current user's preference or site default)
+ * @return mixed success
+ */
function common_init_locale($language=null)
{
if(!$language) {
@@ -50,6 +58,15 @@ function common_init_locale($language=null)
return $ok;
}
+/**
+ * Initialize locale and charset settings and gettext with our message catalog,
+ * using the current user's language preference or the site default.
+ *
+ * This should generally only be run at framework initialization; code switching
+ * languages at runtime should call common_switch_language().
+ *
+ * @access private
+ */
function common_init_language()
{
mb_internal_encoding('UTF-8');