Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 58dd78237b3222e73a62e8dd8a4be001ff49785a Mon Sep 17 00:00:00 2001
- From: Adam Warski <adam@warski.org>
- Date: Tue, 2 Feb 2010 11:52:54 +0100
- Subject: [PATCH] Localizing display names of fields in ProtoUser
- Localizing display names of fields in ProtoUser, also making the localForm method protected instead of public
- ---
- .../src/main/resources/i18n/lift-core.properties | 10 +++++++---
- .../main/resources/i18n/lift-core_pl.properties | 4 ++++
- .../main/scala/net/liftweb/mapper/ProtoUser.scala | 16 ++++++++--------
- 3 files changed, 19 insertions(+), 11 deletions(-)
- diff --git a/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core.properties b/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core.properties
- index d618cdd..c68c35c 100755
- --- a/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core.properties
- +++ b/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core.properties
- @@ -24,7 +24,7 @@ edit.user = Edit User
- validate.user = Validate User
- edit.profile = Edit Profile
- sign.up.confirmation = Sign up confirmation
- -sign.up.message = You have signed up. A validation email message will be sent to you.
- +sign.up.message = You have signed up. A validation email message will be sent to you.
- sign.up.validation.link=Click on this link to complete signup:
- welcome = Welcome
- account.validated = Account Validated
- @@ -53,14 +53,18 @@ new.password = New password
- repeat.password = New password (repeat)
- repeat = Repeat
- edit = Edit
- -cancel = Cancel
- -ok = OK
- +cancel = Cancel
- +ok = OK
- change = Change
- password = Password
- recover.password = Recover Password
- profile.updated = You have updated your profile
- male = Male
- female = Female
- +first.name = First Name
- +last.name = Last Name
- +locale = Locale
- +time.zone = Time Zone
- msg.notice = Notice
- msg.warning = Warning
- msg.error = Error
- diff --git a/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core_pl.properties b/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core_pl.properties
- index 31cbaac..4502c67 100644
- --- a/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core_pl.properties
- +++ b/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core_pl.properties
- @@ -56,6 +56,10 @@ recover.password = Odzyskanie has\u0142a
- profile.updated = Tw\u00f3j profil zosta\u0142 uaktualniony
- male = M\u0119\u017cczyzna
- female = Kobieta
- +first.name = Imi\u0119
- +last.name = Nazwisko
- +locale = J\u0119zyk
- +time.zone = Strefa czasowa
- msg.notice = Notice
- msg.warning = Warning
- msg.error = Error
- diff --git a/framework/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/ProtoUser.scala b/framework/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/ProtoUser.scala
- index 1e00e3e..2af29d7 100644
- --- a/framework/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/ProtoUser.scala
- +++ b/framework/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/ProtoUser.scala
- @@ -46,7 +46,7 @@ trait ProtoUser[T <: ProtoUser[T]] extends KeyedMapper[Long, T] with UserIdAsStr
- override val fieldId = Some(Text("txtFirstName"))
- }
- - def firstNameDisplayName = ??("First Name")
- + def firstNameDisplayName = ??("first.name")
- // Last Name
- object lastName extends MappedString(this, 32) {
- @@ -54,7 +54,7 @@ trait ProtoUser[T <: ProtoUser[T]] extends KeyedMapper[Long, T] with UserIdAsStr
- override val fieldId = Some(Text("txtLastName"))
- }
- - def lastNameDisplayName = ??("Last Name")
- + def lastNameDisplayName = ??("last.name")
- // Email
- object email extends MappedEmail(this, 48) {
- @@ -64,13 +64,13 @@ trait ProtoUser[T <: ProtoUser[T]] extends KeyedMapper[Long, T] with UserIdAsStr
- override val fieldId = Some(Text("txtEmail"))
- }
- - def emailDisplayName = ??("Email")
- + def emailDisplayName = ??("email.address")
- // Password
- object password extends MappedPassword[T](this) {
- override def displayName = fieldOwner.passwordDisplayName
- }
- - def passwordDisplayName = ??("Password")
- + def passwordDisplayName = ??("password")
- object superUser extends MappedBoolean(this) {
- override def defaultValue = false
- @@ -320,7 +320,7 @@ def menus: List[Menu] = sitemap // issue 182
- def signupXhtml(user: ModelType) = {
- (<form method="post" action={S.uri}><table><tr><td
- - colspan="2">{ S.??("Sign Up") }</td></tr>
- + colspan="2">{ S.??("sign.up") }</td></tr>
- {localForm(user, false)}
- <tr><td> </td><td><user:submit/></td></tr>
- </table></form>)
- @@ -625,7 +625,7 @@ def menus: List[Menu] = sitemap // issue 182
- S.redirectTo(homePage)
- }
- - private def localForm(user: ModelType, ignorePassword: Boolean): NodeSeq = {
- + protected def localForm(user: ModelType, ignorePassword: Boolean): NodeSeq = {
- signupFields.
- map(fi => getSingleton.getActualBaseField(user, fi)).
- filter(f => !ignorePassword || (f match {
- @@ -668,9 +668,9 @@ trait MegaProtoUser[T <: MegaProtoUser[T]] extends ProtoUser[T] {
- override val fieldId = Some(Text("txtTimeZone"))
- }
- - def timezoneDisplayName = ??("Time Zone")
- + def timezoneDisplayName = ??("time.zone")
- - def localeDisplayName = ??("Locale")
- + def localeDisplayName = ??("locale")
- }
- --
- 1.6.1.3
Add Comment
Please, Sign In to add comment