Skip to content

Commit

Permalink
remove all locale
Browse files Browse the repository at this point in the history
  • Loading branch information
WaYdotNET committed Aug 28, 2012
1 parent 0beb004 commit cec17d1
Show file tree
Hide file tree
Showing 46 changed files with 17 additions and 946 deletions.
4 changes: 2 additions & 2 deletions padrino-admin/lib/padrino-admin/access_control.rb
Expand Up @@ -164,10 +164,10 @@ def initialize(name, path, options={}) # @private
end

##
# Returns the name of the project module. If a symbol it translate/humanize them for you.
# Returns the name of the project module humanize them for you.
#
def human_name
@name.is_a?(Symbol) ? I18n.t("padrino.admin.menu.#{@name}", :default => @name.to_s.humanize) : @name
@name.to_s.humanize
end

##
Expand Down
2 changes: 1 addition & 1 deletion padrino-admin/lib/padrino-admin/generators/actions.rb
Expand Up @@ -34,7 +34,7 @@ def supported_orm
# Tell us for now wich rendering engine we support
#
def supported_ext
[:haml, :erb, :slim]
[:haml, :slim, :erb]
end

##
Expand Down
12 changes: 3 additions & 9 deletions padrino-admin/lib/padrino-admin/generators/admin_app.rb
Expand Up @@ -8,12 +8,12 @@ class AdminApp < Thor::Group
# Add this generator to our padrino-gen
Padrino::Generators.add_generator(:admin, self)

# Define the source template root and themes.
# Define the source template root
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
# Defines the "banner" text for the CLI.
def self.banner; "padrino-gen admin"; end
# Defines the theme names for admin based on available.
def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/themes/*"].map { |t| File.basename(t) }.sort; end
# def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/themes/*"].map { |t| File.basename(t) }.sort; end

# Include related modules
include Thor::Actions
Expand All @@ -26,7 +26,7 @@ def self.themes; Dir[File.dirname(__FILE__) + "/templates/assets/stylesheets/the
class_option :app, :aliases => "-a", :desc => "The model destination path", :default => '.', :type => :string
class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
class_option :theme, :desc => "Your admin theme: (#{self.themes.join(", ")})", :default => "default", :type => :string
# class_option :theme, :desc => "Your admin theme: (#{self.themes.join(", ")})", :default => "default", :type => :string
class_option :renderer, :aliases => '-e', :desc => "Rendering engine (erb, haml)", :type => :string
class_option :admin_model, :aliases => '-m', :desc => "The name of model for access controlling", :default => 'Account', :type => :string

Expand All @@ -39,11 +39,6 @@ def create_admin
raise SystemExit
end

unless self.class.themes.include?(options[:theme])
say "<= You need to choose a theme from: #{self.class.themes.join(", ")}", :yellow
raise SystemExit
end

tmp_ext = options[:renderer] || fetch_component_choice(:renderer)
unless supported_ext.include?(tmp_ext.to_sym)
say "<= Your are using '#{tmp_ext}' and for admin we only support '#{supported_ext.join(', ')}'. Please use -e haml or -e erb or -e slim", :yellow
Expand Down Expand Up @@ -104,7 +99,6 @@ def create_admin
empty_directory destination_root("admin/views/layouts")
empty_directory destination_root("admin/views/sessions")

template "templates/#{ext}/app/base/_sidebar.#{ext}.tt", destination_root("admin/views/base/_sidebar.#{ext}")
template "templates/#{ext}/app/base/index.#{ext}.tt", destination_root("admin/views/base/index.#{ext}")
template "templates/#{ext}/app/layouts/application.#{ext}.tt", destination_root("admin/views/layouts/application.#{ext}")
template "templates/#{ext}/app/sessions/new.#{ext}.tt", destination_root("admin/views/sessions/new.#{ext}")
Expand Down
62 changes: 11 additions & 51 deletions padrino-admin/lib/padrino-admin/helpers/view_helpers.rb
Expand Up @@ -5,67 +5,27 @@ module Admin
#
module Helpers
##
# i18n translation helpers for admin to retrieve words based on locale.
# Admin helpers
#
module ViewHelpers
##
# Translates a given word for padrino admin
# Icon's Bootstrap helper
#
# @param [String] word
# The specified word to admin translate.
# @param [String] default
# The default fallback if no word is available for the locale.
# @param [Symbol] icon
# The specified icon type
#
# @return [String] The translated word for the current locale.
# @param [Symbol] tag
# The HTML tag.
#
# @example
# # => t("padrino.admin.profile", :default => "Profile")
# pat(:profile)
#
# # => t("padrino.admin.profile", :default => "My Profile")
# pat(:profile, "My Profile")
#
def padrino_admin_translate(word, default=nil)
t("padrino.admin.#{word}", :default => (default || word.to_s.humanize))
end
alias :pat :padrino_admin_translate

##
# Translates attribute name for the given model.
#
# @param [Symbol] model
# The model name for the translation.
# @param [Symbol] attribute
# The attribute name in the model to translate.
#
# @return [String] The translated attribute name for the current locale.
#
# @example
# # => t("models.account.attributes.email", :default => "Email")
# mat(:account, :email)
#
def model_attribute_translate(model, attribute)
t("models.#{model}.attributes.#{attribute}", :default => attribute.to_s.humanize)
end
alias :mat :model_attribute_translate

##
# Translates model name
#
# @param [Symbol] attribute
# The attribute name in the model to translate.
#
# @return [String] The translated model name for the current locale.
# @return [String] html tag with prepend icon
#
# @example
# # => t("models.account.name", :default => "Account")
# mt(:account)
# tag_icon(:edit, :list)
#
def model_translate(model)
t("models.#{model}.name", :default => model.to_s.humanize)
def tag_icon(icon, tag = nil)
content = content_tag(:i, "", :class=> "icon-#{icon.to_s}")
content << tag.to_s
end
alias :mt :model_translate

end # ViewHelpers
end # Helpers
end # Admin
Expand Down
16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/cs.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/da.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/de.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/en.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/es.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/fr.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/hu.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/it.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/ja.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/lv.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/nl.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/no.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/pl.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/pt_br.yml

This file was deleted.

16 changes: 0 additions & 16 deletions padrino-admin/lib/padrino-admin/locale/admin/ro.yml

This file was deleted.

2 comments on commit cec17d1

@k2052
Copy link

@k2052 k2052 commented on cec17d1 Oct 21, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WaYdotNET Why was this done? Are you guys planning on dropping the locale from the admin generators permanently? What is the plan? Tried to find some relevant issues/discussion referencing this but was unable to locate anything.

@WaYdotNET
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bookworm please open issue and ask to staff if dropping is pemanetly. I speak with @DAddYE to remove (at this moment) the locale to admin gen.

Please sign in to comment.