How to customize user name display?

It always display user name in “[first name] [last name]” form, however, Chinese usually need “[last name][first name]” form,how to change it?

1 Like

Good point. This is a current limitation.

You should create a jira issue at XWiki Platform - XWiki.org JIRA

The only solution right now would be to patch the code at xwiki-platform/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java at d5eef693bd3f4b50bf440dd090bf404f3b772a59 · xwiki/xwiki-platform · GitHub

I’ve created the jira at Loading...

Until the Jira issue is picked up and implemented in XWiki, perhaps I can provide our Chinese friends with a temporary solution. This is a CSS based solution depending on switching the label contents of the first name and the last name in the user profile and registration page. It is a bit hacky but it should do the trick.

This piece of CSS can be placed in the advanced section of the theme of your wiki. Route:
Global admin > Look & Feel > Themes > Color theme (customize) > Advanced

html[lang="zh"] { /* Change here for defining LanguageCode_RegionCode (e.g. zh, zh_CN, zh_TW, zh_SG or zh_HK) */
  #profilePane label[for$="first_name"]::before,
  #register label[for$="first_name"]::before {
    content: "姓"; /* Change here for defining the LAST NAME */
  }
  #profilePane label[for$="last_name"]::before,
  #register label[for$="last_name"]::before {
    content: "名"; /* Change here for defining the FIRST NAME */
  }
}

/* Leave CSS below as is (no changes needed). */
html[lang^="zh"] {
  #profilePane label[for$="first_name"]::before,
  #register label[for$="first_name"]::before,
  #profilePane label[for$="last_name"]::before,
  #register label[for$="last_name"]::before {
    position: absolute;
    left: 0;
    visibility: visible;
  }
  #profilePane label[for$="first_name"],
  #register label[for$="first_name"],
  #profilePane label[for$="last_name"],
  #register label[for$="last_name"] {
    position: relative;
    visibility: hidden;
  }
}