Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
After February 6, this site will no longer have Facebook, Twitter, or OpenID sign-in options. Read our announcement about social media SSO support in 2.8 for more info.

Make sure you have a current, valid email address set in your profile and set a password so you can login without it. If you get locked out after that time, you can choose "Forgot Password" to fix it as long as a valid email is on your account.

最新版本中文用户名解决方案

This discussion is related to the Simplified Chinese Locale(简体中文) addon.
andelfandelf New
edited December 2011 in Localization

用户名已经没问题. 需要处理的是 mentions.

config 目录下新建 bootstrap.after.php

<?php
class Chn_MentionsFormatter {
public static function GetMentions($String) {
  // This one grabs mentions that start at the beginning of $String
  preg_match_all(
     '/(?:^|[\s,\.>])@([\d\w\x{4e00}-\x{9faf}]{3,20})\b/ui',
     $String,
     $Matches
  );
  if (count($Matches) > 1) {
     $Result = array_unique($Matches[1]);
     return $Result;
  }
  return array();
}
public static function FormatMentions($Mixed) {
    // return "..................................";
    $Mixed = preg_replace(
       '/(^|[\s,\.>])@([\w\d\x{4e00}-\x{9fa5}]{3,20})\b/ui',
       '\1'.Anchor('@\2', '/profile/\\2'),
       $Mixed
    );
    return $Mixed;
 }
}
Gdn::FactoryInstall('MentionsFormatter', 'Chn_MentionsFormatter', NULL, Gdn::FactoryInstance);

Comments

Sign In or Register to comment.