locales.test.coffee 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. describe "bootbox locales", ->
  2. beforeEach ->
  3. @setLocale = (locale) ->
  4. bootbox.setLocale locale
  5. d1 = bootbox.alert "foo"
  6. d2 = bootbox.confirm "foo", -> true
  7. @labels =
  8. ok: d1.find(".btn:first").text()
  9. cancel: d2.find(".btn:first").text()
  10. confirm: d2.find(".btn:last").text()
  11. describe "Invalid locale", ->
  12. beforeEach ->
  13. @setLocale "xx"
  14. it "shows the default OK translation", ->
  15. expect(@labels.ok).to.equal "OK"
  16. it "shows the default CANCEL translation", ->
  17. expect(@labels.cancel).to.equal "Cancel"
  18. it "shows the default CONFIRM translation", ->
  19. expect(@labels.confirm).to.equal "OK"
  20. describe "English", ->
  21. beforeEach ->
  22. @setLocale "en"
  23. it "shows the correct OK translation", ->
  24. expect(@labels.ok).to.equal "OK"
  25. it "shows the correct CANCEL translation", ->
  26. expect(@labels.cancel).to.equal "Cancel"
  27. it "shows the correct CONFIRM translation", ->
  28. expect(@labels.confirm).to.equal "OK"
  29. describe "French", ->
  30. beforeEach ->
  31. @setLocale "fr"
  32. it "shows the correct OK translation", ->
  33. expect(@labels.ok).to.equal "OK"
  34. it "shows the correct CANCEL translation", ->
  35. expect(@labels.cancel).to.equal "Annuler"
  36. it "shows the correct CONFIRM translation", ->
  37. expect(@labels.confirm).to.equal "D'accord"
  38. describe "German", ->
  39. beforeEach ->
  40. @setLocale "de"
  41. it "shows the correct OK translation", ->
  42. expect(@labels.ok).to.equal "OK"
  43. it "shows the correct CANCEL translation", ->
  44. expect(@labels.cancel).to.equal "Abbrechen"
  45. it "shows the correct CONFIRM translation", ->
  46. expect(@labels.confirm).to.equal "Akzeptieren"
  47. describe "Spanish", ->
  48. beforeEach ->
  49. @setLocale "es"
  50. it "shows the correct OK translation", ->
  51. expect(@labels.ok).to.equal "OK"
  52. it "shows the correct CANCEL translation", ->
  53. expect(@labels.cancel).to.equal "Cancelar"
  54. it "shows the correct CONFIRM translation", ->
  55. expect(@labels.confirm).to.equal "Aceptar"
  56. describe "Portuguese", ->
  57. beforeEach ->
  58. @setLocale "br"
  59. it "shows the correct OK translation", ->
  60. expect(@labels.ok).to.equal "OK"
  61. it "shows the correct CANCEL translation", ->
  62. expect(@labels.cancel).to.equal "Cancelar"
  63. it "shows the correct CONFIRM translation", ->
  64. expect(@labels.confirm).to.equal "Sim"
  65. describe "Dutch", ->
  66. beforeEach ->
  67. @setLocale "nl"
  68. it "shows the correct OK translation", ->
  69. expect(@labels.ok).to.equal "OK"
  70. it "shows the correct CANCEL translation", ->
  71. expect(@labels.cancel).to.equal "Annuleren"
  72. it "shows the correct CONFIRM translation", ->
  73. expect(@labels.confirm).to.equal "Accepteren"
  74. describe "Russian", ->
  75. beforeEach ->
  76. @setLocale "ru"
  77. it "shows the correct OK translation", ->
  78. expect(@labels.ok).to.equal "OK"
  79. it "shows the correct CANCEL translation", ->
  80. expect(@labels.cancel).to.equal "Отмена"
  81. it "shows the correct CONFIRM translation", ->
  82. expect(@labels.confirm).to.equal "Применить"
  83. describe "Indonesian", ->
  84. beforeEach ->
  85. @setLocale "id"
  86. it "shows the correct OK translation", ->
  87. expect(@labels.ok).to.equal "OK"
  88. it "shows the correct CANCEL translation", ->
  89. expect(@labels.cancel).to.equal "Batal"
  90. it "shows the correct CONFIRM translation", ->
  91. expect(@labels.confirm).to.equal "OK"
  92. describe "Italian", ->
  93. beforeEach ->
  94. @setLocale "it"
  95. it "shows the correct OK translation", ->
  96. expect(@labels.ok).to.equal "OK"
  97. it "shows the correct CANCEL translation", ->
  98. expect(@labels.cancel).to.equal "Annulla"
  99. it "shows the correct CONFIRM translation", ->
  100. expect(@labels.confirm).to.equal "Conferma"
  101. describe "Polish", ->
  102. beforeEach ->
  103. @setLocale "pl"
  104. it "shows the correct OK translation", ->
  105. expect(@labels.ok).to.equal "OK"
  106. it "shows the correct CANCEL translation", ->
  107. expect(@labels.cancel).to.equal "Anuluj"
  108. it "shows the correct CONFIRM translation", ->
  109. expect(@labels.confirm).to.equal "Potwierdź"
  110. describe "Danish", ->
  111. beforeEach ->
  112. @setLocale "da"
  113. it "shows the correct OK translation", ->
  114. expect(@labels.ok).to.equal "OK"
  115. it "shows the correct CANCEL translation", ->
  116. expect(@labels.cancel).to.equal "Annuller"
  117. it "shows the correct CONFIRM translation", ->
  118. expect(@labels.confirm).to.equal "Accepter"
  119. describe "Chinese", ->
  120. describe "Taiwan", ->
  121. beforeEach ->
  122. @setLocale "zh_TW"
  123. it "shows the correct OK translation", ->
  124. expect(@labels.ok).to.equal "OK"
  125. it "shows the correct CANCEL translation", ->
  126. expect(@labels.cancel).to.equal "取消"
  127. it "shows the correct CONFIRM translation", ->
  128. expect(@labels.confirm).to.equal "確認"
  129. describe "China", ->
  130. beforeEach ->
  131. @setLocale "zh_CN"
  132. it "shows the correct OK translation", ->
  133. expect(@labels.ok).to.equal "OK"
  134. it "shows the correct CANCEL translation", ->
  135. expect(@labels.cancel).to.equal "取消"
  136. it "shows the correct CONFIRM translation", ->
  137. expect(@labels.confirm).to.equal "确认"
  138. describe "Norwegian", ->
  139. beforeEach ->
  140. @setLocale "no"
  141. it "shows the correct OK translation", ->
  142. expect(@labels.ok).to.equal "OK"
  143. it "shows the correct CANCEL translation", ->
  144. expect(@labels.cancel).to.equal "Avbryt"
  145. it "shows the correct CONFIRM translation", ->
  146. expect(@labels.confirm).to.equal "OK"
  147. describe "Swedish", ->
  148. beforeEach ->
  149. @setLocale "sv"
  150. it "shows the correct OK translation", ->
  151. expect(@labels.ok).to.equal "OK"
  152. it "shows the correct CANCEL translation", ->
  153. expect(@labels.cancel).to.equal "Avbryt"
  154. it "shows the correct CONFIRM translation", ->
  155. expect(@labels.confirm).to.equal "OK"
  156. describe "Latvian", ->
  157. beforeEach ->
  158. @setLocale "lv"
  159. it "shows the correct OK translation", ->
  160. expect(@labels.ok).to.equal "Labi"
  161. it "shows the correct CANCEL translation", ->
  162. expect(@labels.cancel).to.equal "Atcelt"
  163. it "shows the correct CONFIRM translation", ->
  164. expect(@labels.confirm).to.equal "Apstiprināt"
  165. describe "Lithuanian", ->
  166. beforeEach ->
  167. @setLocale "lt"
  168. it "shows the correct OK translation", ->
  169. expect(@labels.ok).to.equal "Gerai"
  170. it "shows the correct CANCEL translation", ->
  171. expect(@labels.cancel).to.equal "Atšaukti"
  172. it "shows the correct CONFIRM translation", ->
  173. expect(@labels.confirm).to.equal "Patvirtinti"
  174. describe "Turkish", ->
  175. beforeEach ->
  176. @setLocale "tr"
  177. it "shows the correct OK translation", ->
  178. expect(@labels.ok).to.equal "Tamam"
  179. it "shows the correct CANCEL translation", ->
  180. expect(@labels.cancel).to.equal "İptal"
  181. it "shows the correct CONFIRM translation", ->
  182. expect(@labels.confirm).to.equal "Onayla"
  183. describe "Hebrew", ->
  184. beforeEach ->
  185. @setLocale "he"
  186. it "shows the correct OK translation", ->
  187. expect(@labels.ok).to.equal "אישור"
  188. it "shows the correct CANCEL translation", ->
  189. expect(@labels.cancel).to.equal "ביטול"
  190. it "shows the correct CONFIRM translation", ->
  191. expect(@labels.confirm).to.equal "אישור"
  192. describe "Greek", ->
  193. beforeEach ->
  194. @setLocale "el"
  195. it "shows the correct OK translation", ->
  196. expect(@labels.ok).to.equal "Εντάξει"
  197. it "shows the correct CANCEL translation", ->
  198. expect(@labels.cancel).to.equal "Ακύρωση"
  199. it "shows the correct CONFIRM translation", ->
  200. expect(@labels.confirm).to.equal "Επιβεβαίωση"
  201. describe "Japanese", ->
  202. beforeEach ->
  203. @setLocale "ja"
  204. it "shows the correct OK translation", ->
  205. expect(@labels.ok).to.equal "OK"
  206. it "shows the correct CANCEL translation", ->
  207. expect(@labels.cancel).to.equal "キャンセル"
  208. it "shows the correct CONFIRM translation", ->
  209. expect(@labels.confirm).to.equal "確認"
  210. describe "Hungarian", ->
  211. beforeEach ->
  212. @setLocale "hu"
  213. it "shows the correct OK translation", ->
  214. expect(@labels.ok).to.equal "OK"
  215. it "shows the correct CANCEL translation", ->
  216. expect(@labels.cancel).to.equal "Mégsem"
  217. it "shows the correct CONFIRM translation", ->
  218. expect(@labels.confirm).to.equal "Megerősít"
  219. describe "Croatian", ->
  220. beforeEach ->
  221. @setLocale "hr"
  222. it "shows the correct OK translation", ->
  223. expect(@labels.ok).to.equal "OK"
  224. it "shows the correct CANCEL translation", ->
  225. expect(@labels.cancel).to.equal "Odustani"
  226. it "shows the correct CONFIRM translation", ->
  227. expect(@labels.confirm).to.equal "Potvrdi"
  228. describe "Bulgarian", ->
  229. beforeEach ->
  230. @setLocale "bg_BG"
  231. it "shows the correct OK translation", ->
  232. expect(@labels.ok).to.equal "Ок"
  233. it "shows the correct CANCEL translation", ->
  234. expect(@labels.cancel).to.equal "Отказ"
  235. it "shows the correct CONFIRM translation", ->
  236. expect(@labels.confirm).to.equal "Потвърждавам"
  237. describe "Thai", ->
  238. beforeEach ->
  239. @setLocale "th"
  240. it "shows the correct OK translation", ->
  241. expect(@labels.ok).to.equal "ตกลง"
  242. it "shows the correct CANCEL translation", ->
  243. expect(@labels.cancel).to.equal "ยกเลิก"
  244. it "shows the correct CONFIRM translation", ->
  245. expect(@labels.confirm).to.equal "ยืนยัน"
  246. describe "Persian", ->
  247. beforeEach ->
  248. @setLocale "fa"
  249. it "shows the correct OK translation", ->
  250. expect(@labels.ok).to.equal "قبول"
  251. it "shows the correct CANCEL translation", ->
  252. expect(@labels.cancel).to.equal "لغو"
  253. it "shows the correct CONFIRM translation", ->
  254. expect(@labels.confirm).to.equal "تایید"
  255. describe "Albanian", ->
  256. beforeEach ->
  257. @setLocale "sq"
  258. it "shows the correct OK translation", ->
  259. expect(@labels.ok).to.equal "OK"
  260. it "shows the correct CANCEL translation", ->
  261. expect(@labels.cancel).to.equal "Anulo"
  262. it "shows the correct CONFIRM translation", ->
  263. expect(@labels.confirm).to.equal "Prano"