ready_for_i18n 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -1,6 +1,26 @@
1
1
  = ready_for_i18n
2
2
 
3
- Description goes here.
3
+ ready_for_i18n is a handy tool in the first step of transfering your local
4
+ Rails project to an i18n one.
5
+
6
+ It will automatically extract hard-coded text from your ERB view file,
7
+ then choose a proper key and replace them with the I18n.translate method.
8
+
9
+ Currently two extractors are available:
10
+
11
+ # TextExtractor will scan all text node in you HTML document, like <b>Hello</b> and extract them and replace with <%=t(:text_hello)%>
12
+ # LabelExtractor will scan all the text in helper methods like link_to('Login'...) and replace with link_to (t(:login))
13
+
14
+
15
+ == Basic Command Line Usage:
16
+ ready_for_i18n <path to ERB source files> <target path>
17
+
18
+ Your erb files in source path will be transformed(i18n_ready)
19
+ and copy to target file path,together with a locale file 'en.yml'.
20
+
21
+ Using the following options:
22
+ --locale [LOCALE] Generating for the specified locale (default locale 'en')
23
+ --ext [EXTENSION] The file extension name of your views(default '.html.erb')
4
24
 
5
25
  == Note on Patches/Pull Requests
6
26
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ready_for_i18n}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["zigzag"]
@@ -29,7 +29,6 @@ Gem::Specification.new do |s|
29
29
  "VERSION",
30
30
  "bin/ready_for_i18n",
31
31
  "lib/base_extractor.rb",
32
- "lib/i18n_automator.rb",
33
32
  "lib/label_extractor.rb",
34
33
  "lib/locale_dictionary.rb",
35
34
  "lib/ready_for_i18n.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ready_for_i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - zigzag
@@ -40,7 +40,6 @@ files:
40
40
  - VERSION
41
41
  - bin/ready_for_i18n
42
42
  - lib/base_extractor.rb
43
- - lib/i18n_automator.rb
44
43
  - lib/label_extractor.rb
45
44
  - lib/locale_dictionary.rb
46
45
  - lib/ready_for_i18n.rb
@@ -1,22 +0,0 @@
1
- require 'ready_for_i18n'
2
- require 'fileutils'
3
-
4
- module ReadyForI18N
5
- class I18nAutomator
6
- def self.run(src_erb_path,target_erb_path,locale_path,locale)
7
- dict = ReadyForI18N::LocaleDictionary.new(locale)
8
- Dir.glob(File.join(src_erb_path,'**/*.html.erb')).each do |f|
9
- target_path = File.dirname(f).gsub(src_erb_path,target_erb_path)
10
- FileUtils.makedirs target_path
11
- target_file = File.join(target_path,File.basename(f))
12
- ReadyForI18N::LabelExtractor.new(f,target_file).extract{|k,v| dict[k] = v}
13
- ReadyForI18N::TextExtractor.new(target_file,target_file).extract{|k,v| dict[k] = v}
14
- end
15
- dict.write_to locale_path
16
- end
17
- end
18
- end
19
-
20
-
21
- srcpath = "/Users/zig/workspace/sonar/tags/1.12/sonar-web/src/main/webapp/WEB-INF/app/views"
22
- ReadyForI18N::I18nAutomator.run(srcpath,'/tmp','/tmp','en')