You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.2 KiB

2 years ago
  1. //
  2. // StringResource.swift
  3. // R.swift.Library
  4. //
  5. // Created by Tom Lokhorst on 2016-04-23.
  6. // From: https://github.com/mac-cain13/R.swift.Library
  7. // License: MIT License
  8. //
  9. import Foundation
  10. public protocol StringResourceType {
  11. /// Key for the string
  12. var key: String { get }
  13. /// File in containing the string
  14. var tableName: String { get }
  15. /// Bundle this string is in
  16. var bundle: Bundle { get }
  17. /// Locales of the a localizable string
  18. var locales: [String] { get }
  19. /// Comment directly before and/or after the string, if any
  20. var comment: String? { get }
  21. }
  22. public struct StringResource: StringResourceType {
  23. /// Key for the string
  24. public let key: String
  25. /// File in containing the string
  26. public let tableName: String
  27. /// Bundle this string is in
  28. public let bundle: Bundle
  29. /// Locales of the a localizable string
  30. public let locales: [String]
  31. /// Comment directly before and/or after the string, if any
  32. public let comment: String?
  33. public init(key: String, tableName: String, bundle: Bundle, locales: [String], comment: String?) {
  34. self.key = key
  35. self.tableName = tableName
  36. self.bundle = bundle
  37. self.locales = locales
  38. self.comment = comment
  39. }
  40. }