motorefi-lit 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +170 -0
- data/Rakefile +38 -0
- data/app/assets/images/lit/famfamfam_flags/ad.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ae.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/af.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ag.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ai.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/al.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/am.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/an.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ao.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ar.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/as.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/at.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/au.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/aw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ax.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/az.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ba.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bb.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bd.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/be.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bi.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bj.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bo.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/br.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bs.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/by.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ca.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/catalonia.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cd.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ch.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ci.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ck.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/co.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cs.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cx.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cy.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/da.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/de.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/dj.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/dk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/dm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/do.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/dz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ec.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ee.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/eg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/eh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/en.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/england.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/er.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/es.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/et.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/europeanunion.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fam.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fi.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fj.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fo.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ga.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gb.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gd.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ge.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gi.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gp.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gq.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gs.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gy.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/hk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/hm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/hn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/hr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ht.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/hu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/id.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ie.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/il.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/in.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/io.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/iq.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ir.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/is.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/it.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ja.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/jm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/jo.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/jp.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ke.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ki.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/km.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kp.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ky.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/la.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lb.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/li.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ls.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ly.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ma.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/md.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/me.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ml.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mo.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mp.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mq.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ms.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mx.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/my.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/na.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ne.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ng.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ni.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/no.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/np.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/om.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pa.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pe.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ph.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ps.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/py.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/qa.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/re.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ro.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/rs.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ru.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/rw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sa.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sb.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/scotland.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sd.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/se.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/si.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sj.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/so.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/st.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sy.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/td.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/th.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tj.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/to.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ua.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ug.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/um.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/us.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/uy.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/uz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/va.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/vc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ve.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/vg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/vi.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/vn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/vu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/wales.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/wf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ws.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ye.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/yt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/za.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/zm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/zw.png +0 -0
- data/app/assets/images/lit/jquery-te.png +0 -0
- data/app/assets/javascripts/lit/application.js +19 -0
- data/app/assets/javascripts/lit/backend/bootstrap.js.coffee +4 -0
- data/app/assets/javascripts/lit/backend/dashboard.js +2 -0
- data/app/assets/javascripts/lit/backend/jquery-te-1.4.0.min.js +9 -0
- data/app/assets/javascripts/lit/backend/localizations.js.coffee +26 -0
- data/app/assets/javascripts/lit/backend/sources.js.coffee +24 -0
- data/app/assets/javascripts/lit/lit_frontend.js +103 -0
- data/app/assets/javascripts/lit/mousetrap.js +1044 -0
- data/app/assets/stylesheets/lit/application.css +59 -0
- data/app/assets/stylesheets/lit/backend/jquery-te-1.4.0.css.scss +457 -0
- data/app/assets/stylesheets/lit/lit_frontend.css +86 -0
- data/app/controllers/lit/api/v1/base_controller.rb +19 -0
- data/app/controllers/lit/api/v1/locales_controller.rb +14 -0
- data/app/controllers/lit/api/v1/localization_keys_controller.rb +15 -0
- data/app/controllers/lit/api/v1/localizations_controller.rb +18 -0
- data/app/controllers/lit/application_controller.rb +49 -0
- data/app/controllers/lit/concerns/request_info_store.rb +16 -0
- data/app/controllers/lit/concerns/request_keys_store.rb +16 -0
- data/app/controllers/lit/dashboard_controller.rb +9 -0
- data/app/controllers/lit/incomming_localizations_controller.rb +49 -0
- data/app/controllers/lit/locales_controller.rb +31 -0
- data/app/controllers/lit/localization_keys_controller.rb +117 -0
- data/app/controllers/lit/localizations_controller.rb +60 -0
- data/app/controllers/lit/sources_controller.rb +77 -0
- data/app/helpers/lit/application_helper.rb +4 -0
- data/app/helpers/lit/dashboard_helper.rb +4 -0
- data/app/helpers/lit/frontend_helper.rb +71 -0
- data/app/helpers/lit/localization_keys_helper.rb +5 -0
- data/app/helpers/lit/localizations_helper.rb +15 -0
- data/app/helpers/lit/sources_helper.rb +7 -0
- data/app/jobs/lit/synchronize_source_job.rb +11 -0
- data/app/models/lit/incomming_localization.rb +77 -0
- data/app/models/lit/locale.rb +48 -0
- data/app/models/lit/localization.rb +103 -0
- data/app/models/lit/localization_key.rb +107 -0
- data/app/models/lit/localization_version.rb +12 -0
- data/app/models/lit/source.rb +111 -0
- data/app/views/kaminari/lit/_first_page.html.erb +5 -0
- data/app/views/kaminari/lit/_gap.html.erb +3 -0
- data/app/views/kaminari/lit/_last_page.html.erb +6 -0
- data/app/views/kaminari/lit/_next_page.html.erb +5 -0
- data/app/views/kaminari/lit/_page.html.erb +3 -0
- data/app/views/kaminari/lit/_paginator.html.erb +17 -0
- data/app/views/kaminari/lit/_prev_page.html.erb +5 -0
- data/app/views/layouts/lit/_messages.html.erb +6 -0
- data/app/views/layouts/lit/_navigation.html.erb +23 -0
- data/app/views/layouts/lit/application.html.erb +46 -0
- data/app/views/lit/dashboard/index.html.erb +5 -0
- data/app/views/lit/incomming_localizations/accept.js.erb +2 -0
- data/app/views/lit/incomming_localizations/destroy.js.erb +1 -0
- data/app/views/lit/incomming_localizations/index.html.erb +52 -0
- data/app/views/lit/locales/_hide_link.html.erb +1 -0
- data/app/views/lit/locales/hide.js.erb +1 -0
- data/app/views/lit/locales/index.html.erb +20 -0
- data/app/views/lit/localization_keys/_localization_row.html.erb +14 -0
- data/app/views/lit/localization_keys/destroy.js.erb +1 -0
- data/app/views/lit/localization_keys/index.html.erb +127 -0
- data/app/views/lit/localization_keys/star.js.erb +1 -0
- data/app/views/lit/localizations/_form.html.erb +23 -0
- data/app/views/lit/localizations/_previous_versions_rows.html.erb +15 -0
- data/app/views/lit/localizations/edit.js.erb +7 -0
- data/app/views/lit/localizations/previous_versions.js.erb +3 -0
- data/app/views/lit/localizations/update.js.erb +4 -0
- data/app/views/lit/sources/_form.html.erb +35 -0
- data/app/views/lit/sources/edit.html.erb +6 -0
- data/app/views/lit/sources/index.html.erb +42 -0
- data/app/views/lit/sources/new.html.erb +5 -0
- data/app/views/lit/sources/show.html.erb +19 -0
- data/config/routes.rb +49 -0
- data/db/migrate/20180101010101_lit_create_lit_locales.rb +16 -0
- data/db/migrate/20180101010102_lit_create_lit_localization_keys.rb +18 -0
- data/db/migrate/20180101010103_lit_create_lit_localizations.rb +24 -0
- data/db/migrate/20180101010104_lit_add_is_completed_and_is_starred_to_localization_keys.rb +17 -0
- data/db/migrate/20180101010105_lit_add_is_hidden_to_locales.rb +12 -0
- data/db/migrate/20180101010106_lit_create_lit_localization_versions.rb +20 -0
- data/db/migrate/20180101010107_lit_create_lit_sources.rb +19 -0
- data/db/migrate/20180101010108_lit_create_lit_incomming_localizations.rb +34 -0
- data/db/migrate/20180101010109_lit_add_sync_complete_to_lit_sources.rb +12 -0
- data/lib/generators/lit/install/templates/initializer.rb +52 -0
- data/lib/generators/lit/install_generator.rb +66 -0
- data/lib/lit.rb +65 -0
- data/lib/lit/adapters/hash_storage.rb +12 -0
- data/lib/lit/adapters/redis_storage.rb +99 -0
- data/lib/lit/cache.rb +356 -0
- data/lib/lit/engine.rb +28 -0
- data/lib/lit/i18n_backend.rb +192 -0
- data/lib/lit/loader.rb +16 -0
- data/lib/lit/rails.rb +17 -0
- data/lib/lit/railtie.rb +12 -0
- data/lib/lit/version.rb +3 -0
- data/lib/tasks/lit_tasks.rake +29 -0
- 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,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,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,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 @@
|
|
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
|
+
|