motorefi-lit 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (347) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +170 -0
  4. data/Rakefile +38 -0
  5. data/app/assets/images/lit/famfamfam_flags/ad.png +0 -0
  6. data/app/assets/images/lit/famfamfam_flags/ae.png +0 -0
  7. data/app/assets/images/lit/famfamfam_flags/af.png +0 -0
  8. data/app/assets/images/lit/famfamfam_flags/ag.png +0 -0
  9. data/app/assets/images/lit/famfamfam_flags/ai.png +0 -0
  10. data/app/assets/images/lit/famfamfam_flags/al.png +0 -0
  11. data/app/assets/images/lit/famfamfam_flags/am.png +0 -0
  12. data/app/assets/images/lit/famfamfam_flags/an.png +0 -0
  13. data/app/assets/images/lit/famfamfam_flags/ao.png +0 -0
  14. data/app/assets/images/lit/famfamfam_flags/ar.png +0 -0
  15. data/app/assets/images/lit/famfamfam_flags/as.png +0 -0
  16. data/app/assets/images/lit/famfamfam_flags/at.png +0 -0
  17. data/app/assets/images/lit/famfamfam_flags/au.png +0 -0
  18. data/app/assets/images/lit/famfamfam_flags/aw.png +0 -0
  19. data/app/assets/images/lit/famfamfam_flags/ax.png +0 -0
  20. data/app/assets/images/lit/famfamfam_flags/az.png +0 -0
  21. data/app/assets/images/lit/famfamfam_flags/ba.png +0 -0
  22. data/app/assets/images/lit/famfamfam_flags/bb.png +0 -0
  23. data/app/assets/images/lit/famfamfam_flags/bd.png +0 -0
  24. data/app/assets/images/lit/famfamfam_flags/be.png +0 -0
  25. data/app/assets/images/lit/famfamfam_flags/bf.png +0 -0
  26. data/app/assets/images/lit/famfamfam_flags/bg.png +0 -0
  27. data/app/assets/images/lit/famfamfam_flags/bh.png +0 -0
  28. data/app/assets/images/lit/famfamfam_flags/bi.png +0 -0
  29. data/app/assets/images/lit/famfamfam_flags/bj.png +0 -0
  30. data/app/assets/images/lit/famfamfam_flags/bm.png +0 -0
  31. data/app/assets/images/lit/famfamfam_flags/bn.png +0 -0
  32. data/app/assets/images/lit/famfamfam_flags/bo.png +0 -0
  33. data/app/assets/images/lit/famfamfam_flags/br.png +0 -0
  34. data/app/assets/images/lit/famfamfam_flags/bs.png +0 -0
  35. data/app/assets/images/lit/famfamfam_flags/bt.png +0 -0
  36. data/app/assets/images/lit/famfamfam_flags/bv.png +0 -0
  37. data/app/assets/images/lit/famfamfam_flags/bw.png +0 -0
  38. data/app/assets/images/lit/famfamfam_flags/by.png +0 -0
  39. data/app/assets/images/lit/famfamfam_flags/bz.png +0 -0
  40. data/app/assets/images/lit/famfamfam_flags/ca.png +0 -0
  41. data/app/assets/images/lit/famfamfam_flags/catalonia.png +0 -0
  42. data/app/assets/images/lit/famfamfam_flags/cc.png +0 -0
  43. data/app/assets/images/lit/famfamfam_flags/cd.png +0 -0
  44. data/app/assets/images/lit/famfamfam_flags/cf.png +0 -0
  45. data/app/assets/images/lit/famfamfam_flags/cg.png +0 -0
  46. data/app/assets/images/lit/famfamfam_flags/ch.png +0 -0
  47. data/app/assets/images/lit/famfamfam_flags/ci.png +0 -0
  48. data/app/assets/images/lit/famfamfam_flags/ck.png +0 -0
  49. data/app/assets/images/lit/famfamfam_flags/cl.png +0 -0
  50. data/app/assets/images/lit/famfamfam_flags/cm.png +0 -0
  51. data/app/assets/images/lit/famfamfam_flags/cn.png +0 -0
  52. data/app/assets/images/lit/famfamfam_flags/co.png +0 -0
  53. data/app/assets/images/lit/famfamfam_flags/cr.png +0 -0
  54. data/app/assets/images/lit/famfamfam_flags/cs.png +0 -0
  55. data/app/assets/images/lit/famfamfam_flags/cu.png +0 -0
  56. data/app/assets/images/lit/famfamfam_flags/cv.png +0 -0
  57. data/app/assets/images/lit/famfamfam_flags/cx.png +0 -0
  58. data/app/assets/images/lit/famfamfam_flags/cy.png +0 -0
  59. data/app/assets/images/lit/famfamfam_flags/cz.png +0 -0
  60. data/app/assets/images/lit/famfamfam_flags/da.png +0 -0
  61. data/app/assets/images/lit/famfamfam_flags/de.png +0 -0
  62. data/app/assets/images/lit/famfamfam_flags/dj.png +0 -0
  63. data/app/assets/images/lit/famfamfam_flags/dk.png +0 -0
  64. data/app/assets/images/lit/famfamfam_flags/dm.png +0 -0
  65. data/app/assets/images/lit/famfamfam_flags/do.png +0 -0
  66. data/app/assets/images/lit/famfamfam_flags/dz.png +0 -0
  67. data/app/assets/images/lit/famfamfam_flags/ec.png +0 -0
  68. data/app/assets/images/lit/famfamfam_flags/ee.png +0 -0
  69. data/app/assets/images/lit/famfamfam_flags/eg.png +0 -0
  70. data/app/assets/images/lit/famfamfam_flags/eh.png +0 -0
  71. data/app/assets/images/lit/famfamfam_flags/en.png +0 -0
  72. data/app/assets/images/lit/famfamfam_flags/england.png +0 -0
  73. data/app/assets/images/lit/famfamfam_flags/er.png +0 -0
  74. data/app/assets/images/lit/famfamfam_flags/es.png +0 -0
  75. data/app/assets/images/lit/famfamfam_flags/et.png +0 -0
  76. data/app/assets/images/lit/famfamfam_flags/europeanunion.png +0 -0
  77. data/app/assets/images/lit/famfamfam_flags/fam.png +0 -0
  78. data/app/assets/images/lit/famfamfam_flags/fi.png +0 -0
  79. data/app/assets/images/lit/famfamfam_flags/fj.png +0 -0
  80. data/app/assets/images/lit/famfamfam_flags/fk.png +0 -0
  81. data/app/assets/images/lit/famfamfam_flags/fm.png +0 -0
  82. data/app/assets/images/lit/famfamfam_flags/fo.png +0 -0
  83. data/app/assets/images/lit/famfamfam_flags/fr.png +0 -0
  84. data/app/assets/images/lit/famfamfam_flags/ga.png +0 -0
  85. data/app/assets/images/lit/famfamfam_flags/gb.png +0 -0
  86. data/app/assets/images/lit/famfamfam_flags/gd.png +0 -0
  87. data/app/assets/images/lit/famfamfam_flags/ge.png +0 -0
  88. data/app/assets/images/lit/famfamfam_flags/gf.png +0 -0
  89. data/app/assets/images/lit/famfamfam_flags/gh.png +0 -0
  90. data/app/assets/images/lit/famfamfam_flags/gi.png +0 -0
  91. data/app/assets/images/lit/famfamfam_flags/gl.png +0 -0
  92. data/app/assets/images/lit/famfamfam_flags/gm.png +0 -0
  93. data/app/assets/images/lit/famfamfam_flags/gn.png +0 -0
  94. data/app/assets/images/lit/famfamfam_flags/gp.png +0 -0
  95. data/app/assets/images/lit/famfamfam_flags/gq.png +0 -0
  96. data/app/assets/images/lit/famfamfam_flags/gr.png +0 -0
  97. data/app/assets/images/lit/famfamfam_flags/gs.png +0 -0
  98. data/app/assets/images/lit/famfamfam_flags/gt.png +0 -0
  99. data/app/assets/images/lit/famfamfam_flags/gu.png +0 -0
  100. data/app/assets/images/lit/famfamfam_flags/gw.png +0 -0
  101. data/app/assets/images/lit/famfamfam_flags/gy.png +0 -0
  102. data/app/assets/images/lit/famfamfam_flags/hk.png +0 -0
  103. data/app/assets/images/lit/famfamfam_flags/hm.png +0 -0
  104. data/app/assets/images/lit/famfamfam_flags/hn.png +0 -0
  105. data/app/assets/images/lit/famfamfam_flags/hr.png +0 -0
  106. data/app/assets/images/lit/famfamfam_flags/ht.png +0 -0
  107. data/app/assets/images/lit/famfamfam_flags/hu.png +0 -0
  108. data/app/assets/images/lit/famfamfam_flags/id.png +0 -0
  109. data/app/assets/images/lit/famfamfam_flags/ie.png +0 -0
  110. data/app/assets/images/lit/famfamfam_flags/il.png +0 -0
  111. data/app/assets/images/lit/famfamfam_flags/in.png +0 -0
  112. data/app/assets/images/lit/famfamfam_flags/io.png +0 -0
  113. data/app/assets/images/lit/famfamfam_flags/iq.png +0 -0
  114. data/app/assets/images/lit/famfamfam_flags/ir.png +0 -0
  115. data/app/assets/images/lit/famfamfam_flags/is.png +0 -0
  116. data/app/assets/images/lit/famfamfam_flags/it.png +0 -0
  117. data/app/assets/images/lit/famfamfam_flags/ja.png +0 -0
  118. data/app/assets/images/lit/famfamfam_flags/jm.png +0 -0
  119. data/app/assets/images/lit/famfamfam_flags/jo.png +0 -0
  120. data/app/assets/images/lit/famfamfam_flags/jp.png +0 -0
  121. data/app/assets/images/lit/famfamfam_flags/ke.png +0 -0
  122. data/app/assets/images/lit/famfamfam_flags/kg.png +0 -0
  123. data/app/assets/images/lit/famfamfam_flags/kh.png +0 -0
  124. data/app/assets/images/lit/famfamfam_flags/ki.png +0 -0
  125. data/app/assets/images/lit/famfamfam_flags/km.png +0 -0
  126. data/app/assets/images/lit/famfamfam_flags/kn.png +0 -0
  127. data/app/assets/images/lit/famfamfam_flags/kp.png +0 -0
  128. data/app/assets/images/lit/famfamfam_flags/kr.png +0 -0
  129. data/app/assets/images/lit/famfamfam_flags/kw.png +0 -0
  130. data/app/assets/images/lit/famfamfam_flags/ky.png +0 -0
  131. data/app/assets/images/lit/famfamfam_flags/kz.png +0 -0
  132. data/app/assets/images/lit/famfamfam_flags/la.png +0 -0
  133. data/app/assets/images/lit/famfamfam_flags/lb.png +0 -0
  134. data/app/assets/images/lit/famfamfam_flags/lc.png +0 -0
  135. data/app/assets/images/lit/famfamfam_flags/li.png +0 -0
  136. data/app/assets/images/lit/famfamfam_flags/lk.png +0 -0
  137. data/app/assets/images/lit/famfamfam_flags/lr.png +0 -0
  138. data/app/assets/images/lit/famfamfam_flags/ls.png +0 -0
  139. data/app/assets/images/lit/famfamfam_flags/lt.png +0 -0
  140. data/app/assets/images/lit/famfamfam_flags/lu.png +0 -0
  141. data/app/assets/images/lit/famfamfam_flags/lv.png +0 -0
  142. data/app/assets/images/lit/famfamfam_flags/ly.png +0 -0
  143. data/app/assets/images/lit/famfamfam_flags/ma.png +0 -0
  144. data/app/assets/images/lit/famfamfam_flags/mc.png +0 -0
  145. data/app/assets/images/lit/famfamfam_flags/md.png +0 -0
  146. data/app/assets/images/lit/famfamfam_flags/me.png +0 -0
  147. data/app/assets/images/lit/famfamfam_flags/mg.png +0 -0
  148. data/app/assets/images/lit/famfamfam_flags/mh.png +0 -0
  149. data/app/assets/images/lit/famfamfam_flags/mk.png +0 -0
  150. data/app/assets/images/lit/famfamfam_flags/ml.png +0 -0
  151. data/app/assets/images/lit/famfamfam_flags/mm.png +0 -0
  152. data/app/assets/images/lit/famfamfam_flags/mn.png +0 -0
  153. data/app/assets/images/lit/famfamfam_flags/mo.png +0 -0
  154. data/app/assets/images/lit/famfamfam_flags/mp.png +0 -0
  155. data/app/assets/images/lit/famfamfam_flags/mq.png +0 -0
  156. data/app/assets/images/lit/famfamfam_flags/mr.png +0 -0
  157. data/app/assets/images/lit/famfamfam_flags/ms.png +0 -0
  158. data/app/assets/images/lit/famfamfam_flags/mt.png +0 -0
  159. data/app/assets/images/lit/famfamfam_flags/mu.png +0 -0
  160. data/app/assets/images/lit/famfamfam_flags/mv.png +0 -0
  161. data/app/assets/images/lit/famfamfam_flags/mw.png +0 -0
  162. data/app/assets/images/lit/famfamfam_flags/mx.png +0 -0
  163. data/app/assets/images/lit/famfamfam_flags/my.png +0 -0
  164. data/app/assets/images/lit/famfamfam_flags/mz.png +0 -0
  165. data/app/assets/images/lit/famfamfam_flags/na.png +0 -0
  166. data/app/assets/images/lit/famfamfam_flags/nc.png +0 -0
  167. data/app/assets/images/lit/famfamfam_flags/ne.png +0 -0
  168. data/app/assets/images/lit/famfamfam_flags/nf.png +0 -0
  169. data/app/assets/images/lit/famfamfam_flags/ng.png +0 -0
  170. data/app/assets/images/lit/famfamfam_flags/ni.png +0 -0
  171. data/app/assets/images/lit/famfamfam_flags/nl.png +0 -0
  172. data/app/assets/images/lit/famfamfam_flags/no.png +0 -0
  173. data/app/assets/images/lit/famfamfam_flags/np.png +0 -0
  174. data/app/assets/images/lit/famfamfam_flags/nr.png +0 -0
  175. data/app/assets/images/lit/famfamfam_flags/nu.png +0 -0
  176. data/app/assets/images/lit/famfamfam_flags/nz.png +0 -0
  177. data/app/assets/images/lit/famfamfam_flags/om.png +0 -0
  178. data/app/assets/images/lit/famfamfam_flags/pa.png +0 -0
  179. data/app/assets/images/lit/famfamfam_flags/pe.png +0 -0
  180. data/app/assets/images/lit/famfamfam_flags/pf.png +0 -0
  181. data/app/assets/images/lit/famfamfam_flags/pg.png +0 -0
  182. data/app/assets/images/lit/famfamfam_flags/ph.png +0 -0
  183. data/app/assets/images/lit/famfamfam_flags/pk.png +0 -0
  184. data/app/assets/images/lit/famfamfam_flags/pl.png +0 -0
  185. data/app/assets/images/lit/famfamfam_flags/pm.png +0 -0
  186. data/app/assets/images/lit/famfamfam_flags/pn.png +0 -0
  187. data/app/assets/images/lit/famfamfam_flags/pr.png +0 -0
  188. data/app/assets/images/lit/famfamfam_flags/ps.png +0 -0
  189. data/app/assets/images/lit/famfamfam_flags/pt.png +0 -0
  190. data/app/assets/images/lit/famfamfam_flags/pw.png +0 -0
  191. data/app/assets/images/lit/famfamfam_flags/py.png +0 -0
  192. data/app/assets/images/lit/famfamfam_flags/qa.png +0 -0
  193. data/app/assets/images/lit/famfamfam_flags/re.png +0 -0
  194. data/app/assets/images/lit/famfamfam_flags/ro.png +0 -0
  195. data/app/assets/images/lit/famfamfam_flags/rs.png +0 -0
  196. data/app/assets/images/lit/famfamfam_flags/ru.png +0 -0
  197. data/app/assets/images/lit/famfamfam_flags/rw.png +0 -0
  198. data/app/assets/images/lit/famfamfam_flags/sa.png +0 -0
  199. data/app/assets/images/lit/famfamfam_flags/sb.png +0 -0
  200. data/app/assets/images/lit/famfamfam_flags/sc.png +0 -0
  201. data/app/assets/images/lit/famfamfam_flags/scotland.png +0 -0
  202. data/app/assets/images/lit/famfamfam_flags/sd.png +0 -0
  203. data/app/assets/images/lit/famfamfam_flags/se.png +0 -0
  204. data/app/assets/images/lit/famfamfam_flags/sg.png +0 -0
  205. data/app/assets/images/lit/famfamfam_flags/sh.png +0 -0
  206. data/app/assets/images/lit/famfamfam_flags/si.png +0 -0
  207. data/app/assets/images/lit/famfamfam_flags/sj.png +0 -0
  208. data/app/assets/images/lit/famfamfam_flags/sk.png +0 -0
  209. data/app/assets/images/lit/famfamfam_flags/sl.png +0 -0
  210. data/app/assets/images/lit/famfamfam_flags/sm.png +0 -0
  211. data/app/assets/images/lit/famfamfam_flags/sn.png +0 -0
  212. data/app/assets/images/lit/famfamfam_flags/so.png +0 -0
  213. data/app/assets/images/lit/famfamfam_flags/sr.png +0 -0
  214. data/app/assets/images/lit/famfamfam_flags/st.png +0 -0
  215. data/app/assets/images/lit/famfamfam_flags/sv.png +0 -0
  216. data/app/assets/images/lit/famfamfam_flags/sy.png +0 -0
  217. data/app/assets/images/lit/famfamfam_flags/sz.png +0 -0
  218. data/app/assets/images/lit/famfamfam_flags/tc.png +0 -0
  219. data/app/assets/images/lit/famfamfam_flags/td.png +0 -0
  220. data/app/assets/images/lit/famfamfam_flags/tf.png +0 -0
  221. data/app/assets/images/lit/famfamfam_flags/tg.png +0 -0
  222. data/app/assets/images/lit/famfamfam_flags/th.png +0 -0
  223. data/app/assets/images/lit/famfamfam_flags/tj.png +0 -0
  224. data/app/assets/images/lit/famfamfam_flags/tk.png +0 -0
  225. data/app/assets/images/lit/famfamfam_flags/tl.png +0 -0
  226. data/app/assets/images/lit/famfamfam_flags/tm.png +0 -0
  227. data/app/assets/images/lit/famfamfam_flags/tn.png +0 -0
  228. data/app/assets/images/lit/famfamfam_flags/to.png +0 -0
  229. data/app/assets/images/lit/famfamfam_flags/tr.png +0 -0
  230. data/app/assets/images/lit/famfamfam_flags/tt.png +0 -0
  231. data/app/assets/images/lit/famfamfam_flags/tv.png +0 -0
  232. data/app/assets/images/lit/famfamfam_flags/tw.png +0 -0
  233. data/app/assets/images/lit/famfamfam_flags/tz.png +0 -0
  234. data/app/assets/images/lit/famfamfam_flags/ua.png +0 -0
  235. data/app/assets/images/lit/famfamfam_flags/ug.png +0 -0
  236. data/app/assets/images/lit/famfamfam_flags/um.png +0 -0
  237. data/app/assets/images/lit/famfamfam_flags/us.png +0 -0
  238. data/app/assets/images/lit/famfamfam_flags/uy.png +0 -0
  239. data/app/assets/images/lit/famfamfam_flags/uz.png +0 -0
  240. data/app/assets/images/lit/famfamfam_flags/va.png +0 -0
  241. data/app/assets/images/lit/famfamfam_flags/vc.png +0 -0
  242. data/app/assets/images/lit/famfamfam_flags/ve.png +0 -0
  243. data/app/assets/images/lit/famfamfam_flags/vg.png +0 -0
  244. data/app/assets/images/lit/famfamfam_flags/vi.png +0 -0
  245. data/app/assets/images/lit/famfamfam_flags/vn.png +0 -0
  246. data/app/assets/images/lit/famfamfam_flags/vu.png +0 -0
  247. data/app/assets/images/lit/famfamfam_flags/wales.png +0 -0
  248. data/app/assets/images/lit/famfamfam_flags/wf.png +0 -0
  249. data/app/assets/images/lit/famfamfam_flags/ws.png +0 -0
  250. data/app/assets/images/lit/famfamfam_flags/ye.png +0 -0
  251. data/app/assets/images/lit/famfamfam_flags/yt.png +0 -0
  252. data/app/assets/images/lit/famfamfam_flags/za.png +0 -0
  253. data/app/assets/images/lit/famfamfam_flags/zm.png +0 -0
  254. data/app/assets/images/lit/famfamfam_flags/zw.png +0 -0
  255. data/app/assets/images/lit/jquery-te.png +0 -0
  256. data/app/assets/javascripts/lit/application.js +19 -0
  257. data/app/assets/javascripts/lit/backend/bootstrap.js.coffee +4 -0
  258. data/app/assets/javascripts/lit/backend/dashboard.js +2 -0
  259. data/app/assets/javascripts/lit/backend/jquery-te-1.4.0.min.js +9 -0
  260. data/app/assets/javascripts/lit/backend/localizations.js.coffee +26 -0
  261. data/app/assets/javascripts/lit/backend/sources.js.coffee +24 -0
  262. data/app/assets/javascripts/lit/lit_frontend.js +103 -0
  263. data/app/assets/javascripts/lit/mousetrap.js +1044 -0
  264. data/app/assets/stylesheets/lit/application.css +59 -0
  265. data/app/assets/stylesheets/lit/backend/jquery-te-1.4.0.css.scss +457 -0
  266. data/app/assets/stylesheets/lit/lit_frontend.css +86 -0
  267. data/app/controllers/lit/api/v1/base_controller.rb +19 -0
  268. data/app/controllers/lit/api/v1/locales_controller.rb +14 -0
  269. data/app/controllers/lit/api/v1/localization_keys_controller.rb +15 -0
  270. data/app/controllers/lit/api/v1/localizations_controller.rb +18 -0
  271. data/app/controllers/lit/application_controller.rb +49 -0
  272. data/app/controllers/lit/concerns/request_info_store.rb +16 -0
  273. data/app/controllers/lit/concerns/request_keys_store.rb +16 -0
  274. data/app/controllers/lit/dashboard_controller.rb +9 -0
  275. data/app/controllers/lit/incomming_localizations_controller.rb +49 -0
  276. data/app/controllers/lit/locales_controller.rb +31 -0
  277. data/app/controllers/lit/localization_keys_controller.rb +117 -0
  278. data/app/controllers/lit/localizations_controller.rb +60 -0
  279. data/app/controllers/lit/sources_controller.rb +77 -0
  280. data/app/helpers/lit/application_helper.rb +4 -0
  281. data/app/helpers/lit/dashboard_helper.rb +4 -0
  282. data/app/helpers/lit/frontend_helper.rb +71 -0
  283. data/app/helpers/lit/localization_keys_helper.rb +5 -0
  284. data/app/helpers/lit/localizations_helper.rb +15 -0
  285. data/app/helpers/lit/sources_helper.rb +7 -0
  286. data/app/jobs/lit/synchronize_source_job.rb +11 -0
  287. data/app/models/lit/incomming_localization.rb +77 -0
  288. data/app/models/lit/locale.rb +48 -0
  289. data/app/models/lit/localization.rb +103 -0
  290. data/app/models/lit/localization_key.rb +107 -0
  291. data/app/models/lit/localization_version.rb +12 -0
  292. data/app/models/lit/source.rb +111 -0
  293. data/app/views/kaminari/lit/_first_page.html.erb +5 -0
  294. data/app/views/kaminari/lit/_gap.html.erb +3 -0
  295. data/app/views/kaminari/lit/_last_page.html.erb +6 -0
  296. data/app/views/kaminari/lit/_next_page.html.erb +5 -0
  297. data/app/views/kaminari/lit/_page.html.erb +3 -0
  298. data/app/views/kaminari/lit/_paginator.html.erb +17 -0
  299. data/app/views/kaminari/lit/_prev_page.html.erb +5 -0
  300. data/app/views/layouts/lit/_messages.html.erb +6 -0
  301. data/app/views/layouts/lit/_navigation.html.erb +23 -0
  302. data/app/views/layouts/lit/application.html.erb +46 -0
  303. data/app/views/lit/dashboard/index.html.erb +5 -0
  304. data/app/views/lit/incomming_localizations/accept.js.erb +2 -0
  305. data/app/views/lit/incomming_localizations/destroy.js.erb +1 -0
  306. data/app/views/lit/incomming_localizations/index.html.erb +52 -0
  307. data/app/views/lit/locales/_hide_link.html.erb +1 -0
  308. data/app/views/lit/locales/hide.js.erb +1 -0
  309. data/app/views/lit/locales/index.html.erb +20 -0
  310. data/app/views/lit/localization_keys/_localization_row.html.erb +14 -0
  311. data/app/views/lit/localization_keys/destroy.js.erb +1 -0
  312. data/app/views/lit/localization_keys/index.html.erb +127 -0
  313. data/app/views/lit/localization_keys/star.js.erb +1 -0
  314. data/app/views/lit/localizations/_form.html.erb +23 -0
  315. data/app/views/lit/localizations/_previous_versions_rows.html.erb +15 -0
  316. data/app/views/lit/localizations/edit.js.erb +7 -0
  317. data/app/views/lit/localizations/previous_versions.js.erb +3 -0
  318. data/app/views/lit/localizations/update.js.erb +4 -0
  319. data/app/views/lit/sources/_form.html.erb +35 -0
  320. data/app/views/lit/sources/edit.html.erb +6 -0
  321. data/app/views/lit/sources/index.html.erb +42 -0
  322. data/app/views/lit/sources/new.html.erb +5 -0
  323. data/app/views/lit/sources/show.html.erb +19 -0
  324. data/config/routes.rb +49 -0
  325. data/db/migrate/20180101010101_lit_create_lit_locales.rb +16 -0
  326. data/db/migrate/20180101010102_lit_create_lit_localization_keys.rb +18 -0
  327. data/db/migrate/20180101010103_lit_create_lit_localizations.rb +24 -0
  328. data/db/migrate/20180101010104_lit_add_is_completed_and_is_starred_to_localization_keys.rb +17 -0
  329. data/db/migrate/20180101010105_lit_add_is_hidden_to_locales.rb +12 -0
  330. data/db/migrate/20180101010106_lit_create_lit_localization_versions.rb +20 -0
  331. data/db/migrate/20180101010107_lit_create_lit_sources.rb +19 -0
  332. data/db/migrate/20180101010108_lit_create_lit_incomming_localizations.rb +34 -0
  333. data/db/migrate/20180101010109_lit_add_sync_complete_to_lit_sources.rb +12 -0
  334. data/lib/generators/lit/install/templates/initializer.rb +52 -0
  335. data/lib/generators/lit/install_generator.rb +66 -0
  336. data/lib/lit.rb +65 -0
  337. data/lib/lit/adapters/hash_storage.rb +12 -0
  338. data/lib/lit/adapters/redis_storage.rb +99 -0
  339. data/lib/lit/cache.rb +356 -0
  340. data/lib/lit/engine.rb +28 -0
  341. data/lib/lit/i18n_backend.rb +192 -0
  342. data/lib/lit/loader.rb +16 -0
  343. data/lib/lit/rails.rb +17 -0
  344. data/lib/lit/railtie.rb +12 -0
  345. data/lib/lit/version.rb +3 -0
  346. data/lib/tasks/lit_tasks.rake +29 -0
  347. metadata +478 -0
@@ -0,0 +1,107 @@
1
+ module Lit
2
+ class LocalizationKey < ActiveRecord::Base
3
+ attr_accessor :interpolated_key
4
+
5
+ ## SCOPES
6
+ scope :completed, proc { where(is_completed: true) }
7
+ scope :not_completed, proc { where(is_completed: false) }
8
+ scope :starred, proc { where(is_starred: true) }
9
+ scope :ordered, proc { order('localization_key asc') }
10
+ scope :after, proc { |dt|
11
+ joins(:localizations)
12
+ .where('lit_localization_keys.updated_at >= ?', dt)
13
+ .where('lit_localizations.is_changed = true')
14
+ }
15
+
16
+ ## ASSOCIATIONS
17
+ has_many :localizations, dependent: :destroy
18
+
19
+ ## VALIDATIONS
20
+ validates :localization_key,
21
+ presence: true,
22
+ uniqueness: { if: :localization_key_changed? }
23
+
24
+ unless defined?(::ActionController::StrongParameters)
25
+ ## ACCESSIBLE
26
+ attr_accessible :localization_key
27
+ end
28
+
29
+ def to_s
30
+ localization_key
31
+ end
32
+
33
+ def clone_localizations
34
+ new_created = false
35
+ Lit::Locale.find_each do |locale|
36
+ localizations.where(locale_id: locale.id).first_or_create do |l|
37
+ l.default_value = interpolated_key
38
+ new_created = true
39
+ end
40
+ end
41
+ if new_created
42
+ Lit::LocalizationKey.update_all ['is_completed=?', false], ['id=? and is_completed=?', id, false]
43
+ end
44
+ end
45
+
46
+ def mark_completed
47
+ self.is_completed = localizations.changed.count(:id) == localizations.count
48
+ end
49
+
50
+ def mark_completed!
51
+ save if mark_completed
52
+ end
53
+
54
+ def mark_all_completed!
55
+ localizations.update_all(['is_changed=?', true])
56
+ mark_completed!
57
+ end
58
+
59
+ def self.order_options
60
+ ['localization_key asc', 'localization_key desc', 'created_at asc', 'created_at desc', 'updated_at asc', 'updated_at desc']
61
+ end
62
+
63
+ # it can be overridden in parent application, for example: {:order => "created_at desc"}
64
+ def self.default_search_options
65
+ {}
66
+ end
67
+
68
+ def self.search(options = {})
69
+ options = options.to_h.reverse_merge(default_search_options).with_indifferent_access
70
+ s = self
71
+ if options[:order] && order_options.include?(options[:order])
72
+ column, order = options[:order].split(' ')
73
+ s = s.order(FakeLocalizationKey.arel_table[column.to_sym].send(order.to_sym))
74
+ else
75
+ s = s.ordered
76
+ end
77
+ localization_key_col = FakeLocalizationKey.arel_table[:localization_key]
78
+ default_value_col = FakeLocalization.arel_table[:default_value]
79
+ translated_value_col = FakeLocalization.arel_table[:translated_value]
80
+ if options[:key_prefix].present?
81
+ q = "#{options[:key_prefix]}%"
82
+ s = s.where(localization_key_col.matches(q))
83
+ end
84
+ if options[:key].present?
85
+ q = "%#{options[:key]}%"
86
+ q_underscore = "%#{options[:key].parameterize.underscore}%"
87
+ cond = localization_key_col.matches(q).or(
88
+ default_value_col.matches(q).or(
89
+ translated_value_col.matches(q)
90
+ )
91
+ ).or(localization_key_col.matches(q_underscore))
92
+ s = s.joins([:localizations]).where(cond)
93
+ end
94
+ unless options[:include_completed].to_i == 1
95
+ s = s.not_completed
96
+ end
97
+ s
98
+ end
99
+
100
+ class FakeLocalizationKey < ActiveRecord::Base
101
+ self.table_name = 'lit_localization_keys'
102
+ end
103
+ class FakeLocalization < ActiveRecord::Base
104
+ self.table_name = 'lit_localizations'
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,12 @@
1
+ module Lit
2
+ class LocalizationVersion < ActiveRecord::Base
3
+ serialize :translated_value
4
+
5
+ ## ASSOCIATIONS
6
+ belongs_to :localization
7
+
8
+ def to_s
9
+ translated_value
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,111 @@
1
+ require 'net/http'
2
+ module Lit
3
+ class Source < ActiveRecord::Base
4
+ LOCALES_PATH = '/api/v1/locales.json'
5
+ LOCALIZATION_KEYS_PATH = '/api/v1/localization_keys.json'
6
+ LOCALIZATIONS_PATH = '/api/v1/localizations.json'
7
+ LAST_CHANGE_PATH = '/api/v1/last_change.json'
8
+
9
+ ## ASSOCIATIONS
10
+ has_many :incomming_localizations
11
+
12
+ ## VALIDATIONS
13
+ validates :api_key, :identifier, :url,
14
+ presence: true
15
+ validates :url,
16
+ format: { with: /\Ahttps?:\/\/.*\/.*[^\/]\Z/i }
17
+
18
+ unless defined?(::ActionController::StrongParameters)
19
+ attr_accessible :api_key, :identifier, :url
20
+ end
21
+
22
+ ## BEFORE & AFTER
23
+ before_create :set_last_updated_at_upon_creation
24
+ after_validation :check_if_url_is_valid
25
+
26
+ def get_last_change
27
+ result = get_from_remote(LAST_CHANGE_PATH)
28
+ result['last_change'] unless result.nil?
29
+ end
30
+
31
+ def synchronize
32
+ after = last_updated_at.nil? ? nil : last_updated_at.to_s(:db)
33
+ result = get_from_remote(LOCALIZATIONS_PATH, after: after)
34
+ unless result.nil?
35
+ if result.is_a?(Array)
36
+ result.each do |r|
37
+ il = IncommingLocalization.new
38
+ if ::Rails::VERSION::MAJOR < 4
39
+ il = IncommingLocalization.where(incomming_id: r['id']).first_or_initialize
40
+ else
41
+ il = IncommingLocalization.find_or_initialize_by(incomming_id: r['id'])
42
+ end
43
+ il.source = self
44
+ il.locale_str = r['locale_str']
45
+ il.locale = Locale.where(locale: il.locale_str).first
46
+ il.localization_key_str = r['localization_key_str']
47
+ il.localization_key = LocalizationKey.where(localization_key: il.localization_key_str).first
48
+ unless il.is_duplicate?(r['value'])
49
+ il.save!
50
+ IncommingLocalization.where(id: il.id).
51
+ update_all(translated_value: r['value'])
52
+ end
53
+ end
54
+ last_change = get_last_change
55
+ last_change = DateTime.parse(last_change) unless last_change.nil?
56
+ touch_last_updated_at(last_change)
57
+ update_column(:sync_complete, true)
58
+ save
59
+ end
60
+ end
61
+ end
62
+
63
+ def touch_last_updated_at!
64
+ touch_last_updated_at
65
+ save
66
+ end
67
+
68
+ private
69
+
70
+ def touch_last_updated_at(time = nil)
71
+ self.last_updated_at = time || Time.now
72
+ end
73
+
74
+ def check_if_url_is_valid
75
+ if errors.empty? && (self.new_record? || self.url_changed?)
76
+ errors.add(:url, 'is not accessible') if get_last_change.nil?
77
+ end
78
+ end
79
+
80
+ def get_from_remote(path, query_values = {})
81
+ result = nil
82
+ begin
83
+ uri = URI(url + path)
84
+ query_values.each do |k, v|
85
+ params = URI.decode_www_form(uri.query || '') << [k, v]
86
+ uri.query = URI.encode_www_form(params)
87
+ end
88
+ req = Net::HTTP::Get.new(uri.request_uri)
89
+ req.add_field('Authorization', %(Token token="#{api_key}"))
90
+ http = Net::HTTP.new(uri.host, uri.port)
91
+ http.use_ssl = (uri.port == 443)
92
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
93
+ res = http.start do |http_started|
94
+ http_started.request(req)
95
+ end
96
+ if res.is_a?(Net::HTTPSuccess)
97
+ result = JSON.parse(res.body)
98
+ end
99
+ rescue => e
100
+ ::Rails.logger.error { "Lit remote error: #{e}" } if defined?(Rails)
101
+ end
102
+ result
103
+ end
104
+
105
+ def set_last_updated_at_upon_creation
106
+ if last_updated_at.blank?
107
+ touch_last_updated_at if Lit.set_last_updated_at_upon_creation
108
+ end
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,5 @@
1
+ <% unless current_page.first? %>
2
+ <li class="first">
3
+ <%= link_to_unless current_page.first?, raw(t('views.pagination.first')), url, :remote => remote %>
4
+ </li>
5
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <li class="page gap disabled">
2
+ <a href="#" onclick="return false;"><%= raw t('views.pagination.truncate') %></a>
3
+ </li>
@@ -0,0 +1,6 @@
1
+ <% unless current_page.last? %>
2
+ <li class="last next">
3
+ <%= link_to_unless current_page.last?, raw(t('views.pagination.last')), url, {:remote => remote} %>
4
+ </li>
5
+ <% end %>
6
+
@@ -0,0 +1,5 @@
1
+ <% unless current_page.last? %>
2
+ <li class="next_page">
3
+ <%= link_to_unless current_page.last?, raw(t('views.pagination.next')), url, :rel => 'next', :remote => remote %>
4
+ </li>
5
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <li class="page <%= "active" if page.current? %>">
2
+ <%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
3
+ </li>
@@ -0,0 +1,17 @@
1
+ <%= paginator.render do %>
2
+ <div>
3
+ <ul class="pagination">
4
+ <%= first_page_tag unless current_page.first? %>
5
+ <%= prev_page_tag unless current_page.first? %>
6
+ <% each_page do |page| %>
7
+ <% if page.left_outer? || page.right_outer? || page.inside_window? %>
8
+ <%= page_tag page %>
9
+ <% elsif !page.was_truncated? %>
10
+ <%= gap_tag %>
11
+ <% end %>
12
+ <% end %>
13
+ <%= next_page_tag unless current_page.last? %>
14
+ <%= last_page_tag unless current_page.last? %>
15
+ </ul>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% unless current_page.first? %>
2
+ <li class="prev">
3
+ <%= link_to_unless current_page.first?, raw(t('views.pagination.previous')), url, :rel => 'prev', :remote => remote %>
4
+ </li>
5
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <% flash.each do |name, msg| %>
2
+ <div class="alert alert-<%= "#{name == :notice ? "success" : "error"}" %>">
3
+ <a class="close" data-dismiss="alert">×</a>
4
+ <%= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String) %>
5
+ </div>
6
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <div class="navbar-header">
2
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
3
+ <span class="sr-only">Toggle navigation</span>
4
+ <span class="icon-bar"></span>
5
+ <span class="icon-bar"></span>
6
+ <span class="icon-bar"></span>
7
+ </button>
8
+ <%= link_to "Lost in translation", root_path, :class=>'navbar-brand' %>
9
+ </div>
10
+ <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
11
+ <ul class="nav navbar-nav">
12
+ <li><%= link_to "Translate!", lit.localization_keys_path %></li>
13
+ <li><%= link_to "Synchronize", lit.sources_path %></li>
14
+ <li class="dropdown">
15
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
16
+ Settings
17
+ <b class="caret"></b>
18
+ </a>
19
+ <ul class="dropdown-menu">
20
+ <li><%= link_to "Locales", lit.locales_path %></li>
21
+ </ul>
22
+ </li>
23
+ </ul>
@@ -0,0 +1,46 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Lost in translation</title>
5
+ <meta charset="utf-8" />
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
8
+ <%= stylesheet_link_tag '//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css', media: 'all' %>
9
+ <%= stylesheet_link_tag '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', media: 'all' %>
10
+ <%= stylesheet_link_tag '//netdna.bootstrapcdn.com/bootswatch/3.0.3/yeti/bootstrap.min.css', media: 'all' %>
11
+ <%= stylesheet_link_tag 'lit/application', media: 'all' %>
12
+ <%= javascript_include_tag 'lit/application' %>
13
+ <%= javascript_include_tag '//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js' %>
14
+ <%= csrf_meta_tags %>
15
+ </head>
16
+ <body class="<%= params[:controller] %>">
17
+ <nav class="navbar navbar-default" role="navigation">
18
+ <%= render 'layouts/lit/navigation' %>
19
+ </nav>
20
+ <div id="main" class="container <%= params[:action] %>" role="main">
21
+ <div class="row">
22
+ <% if content_for?(:sidebar) %>
23
+ <div class="col-lg-3 col-xs-12 col-sm-3 col-md-3">
24
+ <%= yield(:sidebar) %>
25
+ </div>
26
+ <div class="col-lg-9 col-xs-12 col-sm-9 col-md-9">
27
+ <%= render 'layouts/lit/messages' %>
28
+ <%= yield %>
29
+ </div>
30
+ <% else %>
31
+ <div class="col-lg-12 col-xs-12 col-sm-12 col-md-12">
32
+ <%= render 'layouts/lit/messages' %>
33
+ <%= yield %>
34
+ </div>
35
+ <% end %>
36
+ </div>
37
+ <footer>
38
+ <hr/>
39
+ <p>
40
+ Brought to you by
41
+ <a href="http://prograils.com/" target="_blank">Prograils.com</a>
42
+ </p>
43
+ </footer>
44
+ </div>
45
+ </body>
46
+ </html>
@@ -0,0 +1,5 @@
1
+ <strong>All localization keys</strong> <%= Lit::LocalizationKey.count(:id) %><br/>
2
+ <% @locales.each do |l| %>
3
+ <strong><%= image_tag "lit/famfamfam_flags/#{l.locale[0,2]}.png" %> <%= t("lit.locale_to_languages.#{l.locale}", :default=>l.locale) %>:</strong> <span title="<%= "#{l.get_changed_localizations_count}/#{l.get_all_localizations_count}" %>"><%= l.get_translated_percentage %>%</span><br/>
4
+ <% end %>
5
+
@@ -0,0 +1,2 @@
1
+ $('table.incomming-localizations-table tr[data-id="<%= @incomming_localization.id %>"]').remove();
2
+
@@ -0,0 +1 @@
1
+ $('table.incomming-localizations-table tr[data-id="<%= @incomming_localization.id %>"]').remove();
@@ -0,0 +1,52 @@
1
+ <h1>Incomming localizations</h1>
2
+ <input type="hidden" id="source_id" value="<%= @source.id %>">
3
+ <div class="container">
4
+ <div class="row inline-headers">
5
+ <h4 class="<%= source_loading_class(@source) %>">Synchronization in progress, please wait. The page will refresh automatically when done.</h2>
6
+ <span class="pull-right">
7
+ <%= link_to accept_all_source_incomming_localizations_path(@source), :class=>"btn btn-success btn-sm", :data=>{:confirm=>t('lit.common.you_sure', :default=>"Are you sure?")} do %>
8
+ <%= t('lit.common.accept_all', :default=>"Accept all") %>
9
+ <% end %>
10
+ <%= link_to reject_all_source_incomming_localizations_path(@source), :class=>"btn btn-danger btn-sm", :method=>:post, :data=>{:confirm=>t('lit.common.you_sure', :default=>"Are you sure?")} do %>
11
+ <%= t('lit.common.reject_all', :default=>"Reject all") %>
12
+ <% end %>
13
+ </span>
14
+ </div>
15
+ </div>
16
+
17
+
18
+ <table class="table table-bordered table-striped incomming-localizations-table">
19
+ <tr>
20
+ <th>Current value</th>
21
+ <th>Imported value</th>
22
+ <th width="200px"></th>
23
+ </tr>
24
+ <% @incomming_localizations.each do |il| %>
25
+ <tr data-id="<%= il.id %>">
26
+ <td colspan="3">
27
+ <%= image_tag "lit/famfamfam_flags/#{il.locale_str[0,2]}.png" %>
28
+ <strong><%= il.full_key %></strong>
29
+ </td>
30
+ </tr>
31
+ <tr data-id="<%= il.id %>">
32
+ <td>
33
+ <% if il.localization %>
34
+ <%= render partial: '/lit/localization_keys/localization_row', locals: {localization: il.localization.get_value} %>
35
+ <% end %>
36
+ </td>
37
+ <Td>
38
+ <%= render partial: '/lit/localization_keys/localization_row', locals: {localization: il.get_value} %>
39
+ </td>
40
+ <td>
41
+ <%= link_to accept_source_incomming_localization_path(@source, il, format: :js), class: 'btn btn-success btn-sm', remote: true do %>
42
+ <%= draw_icon 'check', class: 'icon-white' %>
43
+ <%= t('lit.common.accept', default: 'Accept') %>
44
+ <% end %>
45
+ <%= link_to source_incomming_localization_path(@source, il, format: :js), class: 'btn btn-danger btn-sm', remote: true, method: :delete, data: {confirm: I18n.t('lit.common.you_sure', default: 'Are you sure?')} do %>
46
+ <%= draw_icon 'times', class: "icon-white" %>
47
+ <%= I18n.t('lit.common.reject', :default=>"Reject") %>
48
+ <% end %>
49
+ </td>
50
+ </tr>
51
+ <% end %>
52
+ </table>
@@ -0,0 +1 @@
1
+ <%= link_to locale.is_hidden? ? 'Show' : 'Hide', hide_locale_path(locale), :method=>:put, :remote=>true %>
@@ -0,0 +1 @@
1
+ $('#hide_link_<%= @locale.id %>').html("<%= j render(:partial=>"hide_link", :locals=>{:locale=>@locale}) %>");
@@ -0,0 +1,20 @@
1
+ <h1>Listing locales</h1>
2
+
3
+ <table class="table table-stripped">
4
+ <tr>
5
+ <th>Locale</th>
6
+ <th width="130">Options</th>
7
+ </tr>
8
+
9
+ <% @locales.each do |locale| %>
10
+ <tr>
11
+ <td><%= locale %></td>
12
+ <td>
13
+ <span id="hide_link_<%= locale.id %>"><%= render :partial=>"hide_link", :locals=>{:locale=>locale} %></span>
14
+ <%= link_to 'Destroy', locale, method: :delete, data: { confirm: 'Are you sure?' } %>
15
+ </td>
16
+ </tr>
17
+ <% end %>
18
+ </table>
19
+
20
+