/src/lib/time/formatter/time_in_french.e

http://github.com/tybor/Liberty · Specman e · 168 lines · 136 code · 6 blank · 26 comment · 4 complexity · 536b3125d6c4be5f7ade6c16dbbc88ea 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_FRENCH
  5. --
  6. -- The French 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 "Dim"
  22. when 1 then
  23. s := once "Lun"
  24. when 2 then
  25. s := once "Mar"
  26. when 3 then
  27. s := once "Mer"
  28. when 4 then
  29. s := once "Jeu"
  30. when 5 then
  31. s := once "Ven"
  32. when 6 then
  33. s := once "Sam"
  34. end
  35. else
  36. inspect
  37. time.week_day
  38. when 0 then
  39. s := once "Dimanche"
  40. when 1 then
  41. s := once "Lundi"
  42. when 2 then
  43. s := once "Mardi"
  44. when 3 then
  45. s := once "Mercredi"
  46. when 4 then
  47. s := once "Jeudi"
  48. when 5 then
  49. s := once "Vendredi"
  50. when 6 then
  51. s := once "Samedi"
  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 "Fev"
  67. when 3 then
  68. s := once "Mar"
  69. when 4 then
  70. s := once "Avr"
  71. when 5 then
  72. s := once "Mai"
  73. when 6 then
  74. s := once "Juin"
  75. when 7 then
  76. s := once "Juil"
  77. when 8 then
  78. s := once "Aout"
  79. when 9 then
  80. s := once "Sept"
  81. when 10 then
  82. s := once "Oct"
  83. when 11 then
  84. s := once "Nov"
  85. when 12 then
  86. s := once "Dec"
  87. end
  88. else
  89. inspect
  90. time.month
  91. when 1 then
  92. s := once "Janvier"
  93. when 2 then
  94. s := once "Fevrier"
  95. when 3 then
  96. s := once "Mars"
  97. when 4 then
  98. s := once "Avril"
  99. when 5 then
  100. s := once "Mai"
  101. when 6 then
  102. s := once "Juin"
  103. when 7 then
  104. s := once "Juillet"
  105. when 8 then
  106. s := once "Aout"
  107. when 9 then
  108. s := once "Septembre"
  109. when 10 then
  110. s := once "Octobre"
  111. when 11 then
  112. s := once "Novembre"
  113. when 12 then
  114. s := once "Decembre"
  115. end
  116. end
  117. buffer.append(s)
  118. end
  119. append_in (buffer: STRING)
  120. do
  121. day_in(buffer)
  122. buffer.extend(' ')
  123. time.day.append_in(buffer)
  124. buffer.extend(' ')
  125. month_in(buffer)
  126. buffer.extend(' ')
  127. if short_mode then
  128. (time.year #\\ 100).append_in(buffer)
  129. else
  130. time.year.append_in(buffer)
  131. end
  132. buffer.extend(' ')
  133. time.hour.append_in(buffer)
  134. buffer.extend('h')
  135. time.minute.append_in(buffer)
  136. buffer.extend('m')
  137. if not short_mode then
  138. time.second.append_in(buffer)
  139. buffer.extend('s')
  140. end
  141. end
  142. end -- class TIME_IN_FRENCH
  143. --
  144. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  145. --
  146. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  147. -- of this software and associated documentation files (the "Software"), to deal
  148. -- in the Software without restriction, including without limitation the rights
  149. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  150. -- copies of the Software, and to permit persons to whom the Software is
  151. -- furnished to do so, subject to the following conditions:
  152. --
  153. -- The above copyright notice and this permission notice shall be included in
  154. -- all copies or substantial portions of the Software.
  155. --
  156. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  157. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  158. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  159. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  160. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  161. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  162. -- THE SOFTWARE.