Sha256: 926ef1ebcfffb6bf01fcc8f644131daf1989caaca2a1e9e9693076fa7abfcc8d

Contents?: true

Size: 604 Bytes

Versions: 153

Compression:

Stored size: 604 Bytes

Contents

module RubyApp

  module Mixins

    module TranslateMixin
      require 'ruby_app'

      def translate

        name = self.is_a?(Class) ? self.to_s : self.class.to_s
        name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
        name.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
        name.tr!("-", "_")
        name.downcase!

        names = name.split('::')

        value = RubyApp::Language.t
        names.each do |name|
          value = value[name]
        end

        return value

      end

      def localize(*parameters)
        return RubyApp::Language.l(*parameters)
      end

    end

  end

end

Version data entries

153 entries across 153 versions & 1 rubygems

Version Path
RubyApp-0.7.16 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.15 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.14 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.13 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.12 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.11 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.10 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.9 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.5 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.4 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.3 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.2 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.1 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.7.0 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.6.71 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.6.70 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.6.69 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.6.68 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.6.67 lib/ruby_app/mixins/translate_mixin.rb
RubyApp-0.6.66 lib/ruby_app/mixins/translate_mixin.rb