Guest User

Untitled

a guest
May 29th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. ## Application controller
  2. before_filter :set_locale
  3.  
  4. [...]
  5.  
  6. def set_locale
  7. if params[:locale]
  8. session[:lang] = params[:locale]
  9. end
  10.  
  11. I18n.locale = session[:lang] || 'pl'
  12. @app_lang = session[:lang] || 'pl'
  13. end
  14.  
  15. ## Model (kilka walidacji)
  16. validates_format_of :login, :with => RE_LOGIN_OK, :message => I18n.t('user.error.login.format'), :if => :not_using_openid?
  17. validates_format_of :name, :with => RE_NAME_OK, :message => I18n.t('user.error.name.format'), :allow_nil => true
  18. ## Plik lang pl
  19. user:
  20. error:
  21. mail: "^Nie poprawny format adresu mail"
  22. login:
  23. presence: "^Musisz wprowadzić login"
  24. length: "^Login jest zbyt krótki"
  25. uniquness: "^Wprowadzony login jest już zajęty"
  26. format: "^Wprowadzony login jest nieprawidłowy"
  27. name:
  28. presence: "^Musisz podać twoje imię"
  29. length: "^Twoje imię jest zbyt krótkie"
  30. format: "^Nie poprawny format imienia"
  31. mail:
  32. presence: "^Musisz podać twój adres email"
  33. uniquness: "^Wprowadzony adres istnieje już w naszej bazie"
  34. format: "^Błędny format wprowadzonego adresu email"
  35. length: "^Wprowadzony adres email jest za krótki!"
  36. openid:
  37. uniquenss: "^Podana tożsamość już istnieje w naszej bazie"
  38. password:
  39. noconfirm: "^Hasło wymaga potwierdzenia"
  40. confirmation: "^Hasło zostało błędnie potwierdzone"
  41. length: "^Wprowadzone hasło jest za krótkie"
  42. presence: "^Musisz zaproponować hasło"
  43. ## Plik lang en
  44. user:
  45. error:
  46. mail: "^Incorrect email address format"
  47. login:
  48. presence: "^You must enter login"
  49. length: "^Login too short"
  50. uniquness: "^The login you enetered is busy"
  51. format: "^The login you entered is incorrect"
  52. name:
  53. presence: "^You must give your name"
  54. length: "^Your name is too short"
  55. format: "^Incorrect name format"
  56. mail:
  57. presence: "^You must give yout email addressl"
  58. uniquness: "^The email address you entered is already in our base"
  59. format: "^Incorrect format of email entered"
  60. length: "^The email address you typed in is too short!"
  61. openid:
  62. uniquenss: "^This identity already exists in our base"
  63. password:
  64. noconfirm: "^Passoword requires conformation"
  65. confirmation: "^Passwors was incorrectly confirmed"
  66. presence: "^You must give your password"
  67. length: "^The password you typed in is too short!"
  68. ## Przy rejestracji otrzymuje (ustawiony PL bo wszystkie inne elementy są załadowane z pl oprócz validacji)
  69. Błędy dotyczą następujących pól:
  70.  
  71. * Passoword requires conformation
  72. * You must enter login
  73. * Login too short
  74. * The login you entered is incorrect
  75. * You must give your password
  76. * The password you typed in is too short!
  77. * You must give yout email addressl
  78. * The email address you typed in is too short!
  79. * Incorrect format of email entered
Add Comment
Please, Sign In to add comment