Sha256: 0ca5cf63ff293548b7465e6db5a1446367c0498ae9ddf99975b2b8c1b4b005fe

Contents?: true

Size: 792 Bytes

Versions: 4

Compression:

Stored size: 792 Bytes

Contents

class GettextSimpleRails::Translators::SimpleFormTranslator
  def detected?
    return ::Kernel.const_defined?("SimpleForm")
  end
  
  def translations
    @translations = {"simple_form" => {
      "hints" => {},
      "placeholders" => {}
    }}
    
    hints = @translations["simple_form"]["hints"]
    placeholders = @translations["simple_form"]["placeholders"]
    
    GettextSimpleRails::ModelInspector.model_classes do |inspector|
      clazz_snake_name = StringCases.camel_to_snake(inspector.clazz.name)
      clazz_hints = {}
      
      hints[clazz_snake_name] = clazz_hints
      placeholders[clazz_snake_name] = clazz_hints
      
      inspector.attributes do |attribute|
        clazz_hints[attribute.name.to_s] = ""
      end
    end
    
    return @translations
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gettext_simple_rails-0.0.19 lib/gettext_simple_rails/translators/simple_form_translator.rb
gettext_simple_rails-0.0.17 lib/gettext_simple_rails/translators/simple_form_translator.rb
gettext_simple_rails-0.0.16 lib/gettext_simple_rails/translators/simple_form_translator.rb
gettext_simple_rails-0.0.15 lib/gettext_simple_rails/translators/simple_form_translator.rb