summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2009-10-20 00:53:08 +0000
committerZach Copley <zach@status.net>2009-10-20 00:53:08 +0000
commit19b870c439120c8d9dcdac37cd161ed00d070ba7 (patch)
tree415fcca4597685cf2d953d6cb56e226b157f3421 /lib/util.php
parent9cdd77625e25e7c506121d42b28c1ec870c2d4e4 (diff)
parentf7a3b30f5b8d42fca0fb8e2f0eb661601a282763 (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/util.php b/lib/util.php
index be10647fc..e641afd4d 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -51,13 +51,23 @@ function common_init_locale($language=null)
function common_init_language()
{
mb_internal_encoding('UTF-8');
+
+ // gettext seems very picky... We first need to setlocale()
+ // to a locale which _does_ exist on the system, and _then_
+ // we can set in another locale that may not be set up
+ // (say, ga_ES for Galego/Galician) it seems to take it.
+ common_init_locale("en_US");
+
$language = common_language();
- // So we don't have to make people install the gettext locales
$locale_set = common_init_locale($language);
- bindtextdomain("statusnet", common_config('site','locale_path'));
+ setlocale(LC_CTYPE, 'C');
+
+ // So we don't have to make people install the gettext locales
+ $path = common_config('site','locale_path');
+ bindtextdomain("statusnet", $path);
bind_textdomain_codeset("statusnet", "UTF-8");
textdomain("statusnet");
- setlocale(LC_CTYPE, 'C');
+
if(!$locale_set) {
common_log(LOG_INFO, 'Language requested:' . $language . ' - locale could not be set. Perhaps that system locale is not installed.', __FILE__);
}
@@ -391,7 +401,7 @@ function common_render_content($text, $notice)
{
$r = common_render_text($text);
$id = $notice->profile_id;
- $r = preg_replace('/(^|[\s\.\,\:\;]+)@([A-Za-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);
+ $r = preg_replace('/(^|\s+)@(['.NICKNAME_FMT.']{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);
$r = preg_replace('/^T ([A-Z0-9]{1,64}) /e', "'T '.common_at_link($id, '\\1').' '", $r);
$r = preg_replace('/(^|[\s\.\,\:\;]+)@#([A-Za-z0-9]{1,64})/e', "'\\1@#'.common_at_hash_link($id, '\\2')", $r);
$r = preg_replace('/(^|[\s\.\,\:\;]+)!([A-Za-z0-9]{1,64})/e', "'\\1!'.common_group_link($id, '\\2')", $r);