Jump to content

Ability to translate username different from pagename


apeisa
 Share

Recommended Posts

Since users are also pages, they use name field as their username. I would really like to have something like "Username" instead of just "Name" there. Also when editing page settings I would like to have "Page name in address bar" instead of just "Name".

There seems to already be some kind of tweaks with name field (it doesn't show the path when editing user), so this might already be possible. I just couldn't find anything.

Link to comment
Share on other sites

Name is a consistent term used throughout ProcessWire and also the term used at the API level, so I'm not sure it's necessary a good idea to change it (or at least it might be confusing). But I'm guessing it could be done by way of a hook after ProcessPageEdit::buildForm:

public function hookBuildForm($event) {
  if($event->object->getPage()->template != 'user') return;
  $form = $event->return; 
  $field = $form->get('_pw_page_name'); 
  $field->label = 'Username';
}

As for "page name in address bar", I don't think that we ever actually use the the name in the address bar for users since there is no /site/templates/user.php by default. So I'm confused on that one. :)

Link to comment
Share on other sites

As for "page name in address bar", I don't think that we ever actually use the the name in the address bar for users since there is no /site/templates/user.php by default. So I'm confused on that one. :)

I don't think he meant the address bar? Apeisa, do you mean the label  "Name*", in the first field when editing page settings.See screenshot. I could be wrong...I have been before :)

post-894-0-84556800-1369344293_thumb.png

Link to comment
Share on other sites

Ah, sorry. I was a bit unclear.

We have translated the "name" in Finnish: "Sivun nimi selaimen osoitepalkissa", which means "page name in browser's address bar". Our client's found "name" a bit unclear (what does it mean? Where it is used?).

That translation then of course doesn't make any sense in user context. Our first option was to fallback to "name", but that didn't make full sense in user context either, since first two fields in user template (in our default setup) are "Firstname", and "Lastname". So it has been little unclear for clients "Name, Firstname and Lastname", it would be more clear to have "Username, Firstname and Lastname".

PW uses "username" on login form (http://processwire.com/skyscrapers/admin/), but "name" on when editing/adding users.

Convention with API usage doesn't matter, since it doesn't match with Finnish in any case.

This is definitely detail and will think about hooking (I need to support multiple languages, so it little bit more difficult).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...