prograils / lit

rails i18n web interface
MIT License
298 stars 71 forks source link

Various improvements #100

Closed Silex closed 6 years ago

Silex commented 6 years ago

Hello,

I think most of them are straightforward, the last commit https://github.com/prograils/lit/commit/dafc11dacb1d0247f274baa10710b8fffccee075 allows me to do this in order to get clean simple_form translations:

class ActionController::Base
  def render(*args)
    Rails.application.config.helpers = helpers
    super
  end
end

module SimpleForm
  module Components
    module Labels
      def label_translation
        Rails.application.config.helpers.t(format('activerecord.attributes.%s.%s', object.class.to_s.downcase, reflection_or_attribute_name.to_s))
      end
    end
  end
end

Without the last commit I get the "translation missing" texts from I18n and then the spans from rails t().

Silex commented 6 years ago

I found out that is_completed is not set correctly. The only way to make it work was to run this:

Lit::LocalizationKey.all.each{ |l| l.mark_completed; l.save };

It looks like there is a lot of touchy code in there. Any reason for is_changed to be modified from the controller? https://github.com/prograils/lit/blob/master/app/controllers/lit/localizations_controller.rb#L19