Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. // Common - Portuguese - pt-BR.lproj/Localizable.strings
  2. // "common.change" = "Mudar";
  3. // "common.error" = "Erro";
  4. // "common.delete" = "Exluir";
  5. // "common.wait" = "Aguarde";
  6.  
  7. // Common - English - en.lproj/Localizable.strings
  8. // "common.change" = "Change";
  9. // "common.error" = "Error";
  10. // "common.delete" = "Delete";
  11. // "common.wait" = "Wait";
  12.  
  13.  
  14. // MARK: - Project Constants
  15. enum Project {
  16.  
  17. // Image Names
  18. enum Images {
  19. enum Checkout: String, ImageRepresentable {
  20. case first = "icon-first-image"
  21. case second = "icon-second-image"
  22. }
  23. }
  24.  
  25. // Localizable Strings
  26. enum Localizable {
  27.  
  28. // Common
  29. enum Common: String, LocalizeRepresentable {
  30. case change = "common.change"
  31. case error = "common.error"
  32. case delete = "common.delete"
  33. case wait = "common.wait"
  34. }
  35. }
  36. }
  37.  
  38.  
  39. // MARK: - Representable Protocols
  40. protocol ImageRepresentable: RawRepresentable {
  41. var image: UIImage? { get }
  42. }
  43.  
  44. protocol LocalizeRepresentable: RawRepresentable {
  45. var localized: String { get }
  46. }
  47.  
  48.  
  49. // MARK: - Representable Protocols Extensions
  50. extension ImageRepresentable where RawValue == String {
  51. var image: UIImage? {
  52. return UIImage(named: rawValue)
  53. }
  54. }
  55.  
  56. extension LocalizeRepresentable where RawValue == String {
  57. var localized: String {
  58. return NSLocalizedString(rawValue, comment: "")
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement