/src/lib/time/formatter/time_in_german.e

http://github.com/tybor/Liberty · Specman e · 191 lines · 159 code · 6 blank · 26 comment · 9 complexity · ef9a78f6f5b16d41f941b60557d77660 MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class TIME_IN_GERMAN
  5. --
  6. -- The German format class for class TIME.
  7. --
  8. inherit
  9. TIME_FORMATTER
  10. create {ANY}
  11. default_create, set_time
  12. feature {ANY}
  13. day_in (buffer: STRING)
  14. local
  15. s: STRING
  16. do
  17. if short_mode then
  18. inspect
  19. time.week_day
  20. when 0 then
  21. s := once "So"
  22. when 1 then
  23. s := once "Mo"
  24. when 2 then
  25. s := once "Di"
  26. when 3 then
  27. s := once "Mi"
  28. when 4 then
  29. s := once "Do"
  30. when 5 then
  31. s := once "Fr"
  32. when 6 then
  33. s := once "Sa"
  34. end
  35. else
  36. inspect
  37. time.week_day
  38. when 0 then
  39. s := once "Sonntag"
  40. when 1 then
  41. s := once "Montag"
  42. when 2 then
  43. s := once "Dienstag"
  44. when 3 then
  45. s := once "Mittwoch"
  46. when 4 then
  47. s := once "Donnerstag"
  48. when 5 then
  49. s := once "Freitag"
  50. when 6 then
  51. s := once "Samstag"
  52. end
  53. end
  54. buffer.append(s)
  55. end
  56. month_in (buffer: STRING)
  57. local
  58. s: STRING
  59. do
  60. if short_mode then
  61. inspect
  62. time.month
  63. when 1 then
  64. s := once "Jan"
  65. when 2 then
  66. s := once "Feb"
  67. when 3 then
  68. s := once "Mär"
  69. when 4 then
  70. s := once "Apr"
  71. when 5 then
  72. s := once "Mai"
  73. when 6 then
  74. s := once "Jun"
  75. when 7 then
  76. s := once "Jul"
  77. when 8 then
  78. s := once "Aug"
  79. when 9 then
  80. s := once "Sep"
  81. when 10 then
  82. s := once "Okt"
  83. when 11 then
  84. s := once "Nov"
  85. when 12 then
  86. s := once "Dez"
  87. end
  88. else
  89. inspect
  90. time.month
  91. when 1 then
  92. s := once "Januar"
  93. when 2 then
  94. s := once "Februar"
  95. when 3 then
  96. s := once "März"
  97. when 4 then
  98. s := once "April"
  99. when 5 then
  100. s := once "Mai"
  101. when 6 then
  102. s := once "Juni"
  103. when 7 then
  104. s := once "Juli"
  105. when 8 then
  106. s := once "August"
  107. when 9 then
  108. s := once "September"
  109. when 10 then
  110. s := once "Oktober"
  111. when 11 then
  112. s := once "November"
  113. when 12 then
  114. s := once "Dezember"
  115. end
  116. end
  117. buffer.append(s)
  118. end
  119. append_in (buffer: STRING)
  120. local
  121. tmp: STRING
  122. do
  123. day_in(buffer)
  124. buffer.extend(',')
  125. buffer.extend(' ')
  126. tmp := time.day.to_string
  127. if 2 > tmp.count then
  128. tmp.insert_character('0', 1)
  129. end
  130. buffer.append_string(tmp)
  131. buffer.append_character('.')
  132. buffer.append_character(' ')
  133. month_in(buffer)
  134. buffer.append_character(' ')
  135. if short_mode then
  136. tmp := (time.year #\\ 100).to_string
  137. if 2 > tmp.count then
  138. tmp.insert_character('0', 1)
  139. end
  140. buffer.append_string(tmp)
  141. else
  142. time.year.append_in(buffer)
  143. end
  144. buffer.extend(' ')
  145. tmp := time.hour.to_string
  146. if 2 > tmp.count then
  147. tmp.insert_character('0', 1)
  148. end
  149. buffer.append_string(tmp)
  150. buffer.append_character(':')
  151. tmp := time.minute.to_string
  152. if 2 > tmp.count then
  153. tmp.insert_character('0', 1)
  154. end
  155. buffer.append_string(tmp)
  156. if not short_mode then
  157. buffer.append_character(':')
  158. tmp := time.second.to_string
  159. if 2 > tmp.count then
  160. tmp.insert_character('0', 1)
  161. end
  162. buffer.append_string(tmp)
  163. end
  164. end
  165. end -- class TIME_IN_GERMAN
  166. --
  167. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  168. --
  169. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  170. -- of this software and associated documentation files (the "Software"), to deal
  171. -- in the Software without restriction, including without limitation the rights
  172. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  173. -- copies of the Software, and to permit persons to whom the Software is
  174. -- furnished to do so, subject to the following conditions:
  175. --
  176. -- The above copyright notice and this permission notice shall be included in
  177. -- all copies or substantial portions of the Software.
  178. --
  179. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  180. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  181. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  182. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  183. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  184. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  185. -- THE SOFTWARE.