Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sven Fuchs
committed
Jul 4, 2009
1 parent
2177992
commit e02af58
Showing
13 changed files
with
143 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,68 @@ | ||
Gem::Specification.new do |s| | ||
s.name = "i18n-tools" | ||
s.version = "0.0.4" | ||
s.version = "0.0.5" | ||
s.date = "2009-05-26" | ||
s.summary = "Tools for Ruby/Rails I18n" | ||
s.email = "rails-i18n@googlegroups.com" | ||
s.homepage = "http://rails-i18n.org" | ||
s.description = "Tools for Ruby/Rails I18n" | ||
s.has_rdoc = false | ||
s.authors = ['Sven Fuchs'] | ||
s.files = [ | ||
'bin/i18n-keys', | ||
'lib/ansi.rb', | ||
'lib/i18n/keys/commands.rb', | ||
'lib/i18n/keys/format.rb', | ||
'lib/i18n/keys/index.rb', | ||
'lib/i18n/keys/call.rb', | ||
'lib/i18n/keys.rb', | ||
'lib/i18n/parser/erb_parser.rb', | ||
'lib/i18n/parser/ruby_parser.rb', | ||
'MIT-LICENSE', | ||
'README.textile' | ||
] | ||
s.test_files = [ | ||
'test/all.rb', | ||
'test/commands_test.rb', | ||
'test/erb_parser_test.rb', | ||
'test/fixtures/source_1.rb', | ||
'test/fixtures/source_2.rb', | ||
'test/fixtures/template.html.erb', | ||
'test/index_test.rb', | ||
'test/keys_test.rb', | ||
'test/call_test.rb', | ||
'test/ruby_parser_test.rb', | ||
'test/test_helper.rb' | ||
] | ||
s.add_dependency('visionmedia-commander', ['= 3.2.9']) | ||
s.executables = ['i18n-keys'] | ||
s.default_executable = 'i18n-keys' | ||
s.files = %w( | ||
lib/core_ext/hash/iterate_nested.rb | ||
lib/core_ext/hash/slice.rb | ||
lib/core_ext/hash/sorted_yaml_style.rb | ||
lib/core_ext/hash/symbolize_keys.rb | ||
lib/core_ext/module/attribute_accessors.rb | ||
lib/core_ext/object/deep_clone.rb | ||
lib/core_ext/object/instance_variables.rb | ||
lib/core_ext/object/meta_class.rb | ||
lib/core_ext/object/tap.rb | ||
lib/i18n/backend/simple_storage.rb | ||
lib/i18n/commands/keys.rb | ||
lib/i18n/exceptions/key_exists.rb | ||
lib/i18n/index/base.rb | ||
lib/i18n/index/file.rb | ||
lib/i18n/index/format.rb | ||
lib/i18n/index/key.rb | ||
lib/i18n/index/occurence.rb | ||
lib/i18n/index/simple/data.rb | ||
lib/i18n/index/simple/storage.rb | ||
lib/i18n/index/simple.rb | ||
lib/i18n/index.rb | ||
lib/i18n/ripper2ruby/ruby_builder.rb | ||
lib/i18n/ripper2ruby/translate_args_list.rb | ||
lib/i18n/ripper2ruby/translate_call.rb | ||
lib/i18n/ripper2ruby.rb | ||
lib/i18n/translation_properties.rb | ||
MIT-LICENSE | ||
README.markdown | ||
) | ||
s.test_files = %w( | ||
test/all.rb | ||
test/core_ext/hash_iterate_nested.rb | ||
test/fixtures/all.rb.src | ||
test/fixtures/config.yml | ||
test/fixtures/locale/de.yml | ||
test/fixtures/locale/en.yml | ||
test/fixtures/source_1.rb | ||
test/fixtures/source_2.rb | ||
test/fixtures/template.html.erb | ||
test/fixtures/translate/double_key.rb | ||
test/fixtures/translate/double_scope.rb | ||
test/fixtures/translate/single_key.rb | ||
test/fixtures/translate/single_scope.rb | ||
test/i18n/backend/simple_storage_test.rb | ||
test/i18n/backend/translation_properties_test.rb | ||
test/i18n/index/all.rb | ||
test/i18n/index/args_replace_test.rb | ||
test/i18n/index/calls_replace_test.rb | ||
test/i18n/index/commands_test.rb | ||
test/i18n/index/key_test.rb | ||
test/i18n/index/simple_test.rb | ||
test/i18n/ruby/translate_call_test.rb | ||
test/test_helper.rb ) | ||
# s.add_dependency('svenfuchs-ripper2ruby', ['>= 0.0.1']) | ||
# s.executables = ['i18n-keys'] | ||
# s.default_executable = 'i18n-keys' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,6 @@ def save | |
end | ||
|
||
def parse(file) | ||
# puts " parsing #{::File.expand_path(file)}" | ||
format.out '.' | ||
super | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
module I18n | ||
module Ripper | ||
class RubyBuilder < ::Ripper::RubyBuilder | ||
def on_stmts_add(target, statement) | ||
super.tap do | ||
collect_translate_call(statement.to_translate_call) if statement.is_a?(Ruby::Call) | ||
end | ||
end | ||
|
||
def translate_calls | ||
@translate_calls ||= [] | ||
end | ||
|
||
def collect_translate_call(call) | ||
call.tap { |c| translate_calls << c } if is_translate_call?(call) | ||
end | ||
|
||
KEY_CLASSES = [Ruby::Symbol, Ruby::DynaSymbol, Ruby::String, Ruby::Array] | ||
|
||
def is_translate_call?(call) | ||
call.identifier.try(:token) == 't' && | ||
(!call.target.respond_to?(:token) || call.target.token == 'I18n') && | ||
call.arguments && KEY_CLASSES.include?(call.arguments.first.arg.class) | ||
end | ||
# def on_stmts_add(target, statement) | ||
# super.tap do | ||
# statement = statement.select(Ruby::Call) unless statement.nil? || statement.is_a?(Ruby::Call) | ||
# collect_translate_call(statement.to_translate_call) if statement.is_a?(Ruby::Call) | ||
# end | ||
# end | ||
# | ||
# def translate_calls | ||
# @translate_calls ||= [] | ||
# end | ||
# | ||
# def collect_translate_call(call) | ||
# call.tap { |c| translate_calls << c } if is_translate_call?(call) | ||
# end | ||
# | ||
# KEY_CLASSES = [Ruby::Symbol, Ruby::DynaSymbol, Ruby::String, Ruby::Array] | ||
# | ||
# def is_translate_call?(call) | ||
# call.identifier.try(:token) == 't' && | ||
# (!call.target.respond_to?(:token) || call.target.token == 'I18n') && | ||
# call.arguments && KEY_CLASSES.include?(call.arguments.first.arg.class) | ||
# end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.