Guest User

Untitled

a guest
Apr 8th, 2018
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.21 KB | None | 0 0
  1. From 58dd78237b3222e73a62e8dd8a4be001ff49785a Mon Sep 17 00:00:00 2001
  2. From: Adam Warski <adam@warski.org>
  3. Date: Tue, 2 Feb 2010 11:52:54 +0100
  4. Subject: [PATCH] Localizing display names of fields in ProtoUser
  5. Localizing display names of fields in ProtoUser, also making the localForm method protected instead of public
  6.  
  7. ---
  8. .../src/main/resources/i18n/lift-core.properties | 10 +++++++---
  9. .../main/resources/i18n/lift-core_pl.properties | 4 ++++
  10. .../main/scala/net/liftweb/mapper/ProtoUser.scala | 16 ++++++++--------
  11. 3 files changed, 19 insertions(+), 11 deletions(-)
  12.  
  13. 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
  14. index d618cdd..c68c35c 100755
  15. --- a/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core.properties
  16. +++ b/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core.properties
  17. @@ -24,7 +24,7 @@ edit.user = Edit User
  18. validate.user = Validate User
  19. edit.profile = Edit Profile
  20. sign.up.confirmation = Sign up confirmation
  21. -sign.up.message = You have signed up. A validation email message will be sent to you.
  22. +sign.up.message = You have signed up. A validation email message will be sent to you.
  23. sign.up.validation.link=Click on this link to complete signup:
  24. welcome = Welcome
  25. account.validated = Account Validated
  26. @@ -53,14 +53,18 @@ new.password = New password
  27. repeat.password = New password (repeat)
  28. repeat = Repeat
  29. edit = Edit
  30. -cancel = Cancel
  31. -ok = OK
  32. +cancel = Cancel
  33. +ok = OK
  34. change = Change
  35. password = Password
  36. recover.password = Recover Password
  37. profile.updated = You have updated your profile
  38. male = Male
  39. female = Female
  40. +first.name = First Name
  41. +last.name = Last Name
  42. +locale = Locale
  43. +time.zone = Time Zone
  44. msg.notice = Notice
  45. msg.warning = Warning
  46. msg.error = Error
  47. 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
  48. index 31cbaac..4502c67 100644
  49. --- a/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core_pl.properties
  50. +++ b/framework/lift-base/lift-webkit/src/main/resources/i18n/lift-core_pl.properties
  51. @@ -56,6 +56,10 @@ recover.password = Odzyskanie has\u0142a
  52. profile.updated = Tw\u00f3j profil zosta\u0142 uaktualniony
  53. male = M\u0119\u017cczyzna
  54. female = Kobieta
  55. +first.name = Imi\u0119
  56. +last.name = Nazwisko
  57. +locale = J\u0119zyk
  58. +time.zone = Strefa czasowa
  59. msg.notice = Notice
  60. msg.warning = Warning
  61. msg.error = Error
  62. 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
  63. index 1e00e3e..2af29d7 100644
  64. --- a/framework/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/ProtoUser.scala
  65. +++ b/framework/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/ProtoUser.scala
  66. @@ -46,7 +46,7 @@ trait ProtoUser[T <: ProtoUser[T]] extends KeyedMapper[Long, T] with UserIdAsStr
  67. override val fieldId = Some(Text("txtFirstName"))
  68. }
  69.  
  70. - def firstNameDisplayName = ??("First Name")
  71. + def firstNameDisplayName = ??("first.name")
  72.  
  73. // Last Name
  74. object lastName extends MappedString(this, 32) {
  75. @@ -54,7 +54,7 @@ trait ProtoUser[T <: ProtoUser[T]] extends KeyedMapper[Long, T] with UserIdAsStr
  76. override val fieldId = Some(Text("txtLastName"))
  77. }
  78.  
  79. - def lastNameDisplayName = ??("Last Name")
  80. + def lastNameDisplayName = ??("last.name")
  81.  
  82. // Email
  83. object email extends MappedEmail(this, 48) {
  84. @@ -64,13 +64,13 @@ trait ProtoUser[T <: ProtoUser[T]] extends KeyedMapper[Long, T] with UserIdAsStr
  85. override val fieldId = Some(Text("txtEmail"))
  86. }
  87.  
  88. - def emailDisplayName = ??("Email")
  89. + def emailDisplayName = ??("email.address")
  90. // Password
  91. object password extends MappedPassword[T](this) {
  92. override def displayName = fieldOwner.passwordDisplayName
  93. }
  94.  
  95. - def passwordDisplayName = ??("Password")
  96. + def passwordDisplayName = ??("password")
  97.  
  98. object superUser extends MappedBoolean(this) {
  99. override def defaultValue = false
  100. @@ -320,7 +320,7 @@ def menus: List[Menu] = sitemap // issue 182
  101.  
  102. def signupXhtml(user: ModelType) = {
  103. (<form method="post" action={S.uri}><table><tr><td
  104. - colspan="2">{ S.??("Sign Up") }</td></tr>
  105. + colspan="2">{ S.??("sign.up") }</td></tr>
  106. {localForm(user, false)}
  107. <tr><td>&nbsp;</td><td><user:submit/></td></tr>
  108. </table></form>)
  109. @@ -625,7 +625,7 @@ def menus: List[Menu] = sitemap // issue 182
  110. S.redirectTo(homePage)
  111. }
  112.  
  113. - private def localForm(user: ModelType, ignorePassword: Boolean): NodeSeq = {
  114. + protected def localForm(user: ModelType, ignorePassword: Boolean): NodeSeq = {
  115. signupFields.
  116. map(fi => getSingleton.getActualBaseField(user, fi)).
  117. filter(f => !ignorePassword || (f match {
  118. @@ -668,9 +668,9 @@ trait MegaProtoUser[T <: MegaProtoUser[T]] extends ProtoUser[T] {
  119. override val fieldId = Some(Text("txtTimeZone"))
  120. }
  121.  
  122. - def timezoneDisplayName = ??("Time Zone")
  123. + def timezoneDisplayName = ??("time.zone")
  124.  
  125. - def localeDisplayName = ??("Locale")
  126. + def localeDisplayName = ??("locale")
  127.  
  128. }
  129.  
  130. --
  131. 1.6.1.3
Add Comment
Please, Sign In to add comment