i18n_screwdriver 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@ module I18nScrewdriver
8
8
  end
9
9
 
10
10
  def self.for_key(string)
11
- string.gsub(/\./, "").strip
11
+ Digest::MD5.hexdigest(string.strip)
12
12
  end
13
13
 
14
14
  def self.load_translations(locale)
@@ -21,7 +21,7 @@ module I18nScrewdriver
21
21
  File.open(filename(locale), "w") do |file|
22
22
  file.puts "# use rake task i18n:update to generate this file"
23
23
  file.puts
24
- file.puts({locale => translations}.to_yaml)
24
+ file.puts({locale => in_utf8(translations)}.to_yaml)
25
25
  file.puts
26
26
  end
27
27
  end
@@ -32,5 +32,13 @@ module I18nScrewdriver
32
32
  texts.concat(string.scan(/_\('([^']+)'\)/).map{ |v| v[0] })
33
33
  end
34
34
  end
35
+
36
+ def self.in_utf8(hash)
37
+ {}.tap do |result|
38
+ hash.each do |k, v|
39
+ result[k.encode('UTF-8')] = (v || "").encode('UTF-8')
40
+ end
41
+ end
42
+ end
35
43
  end
36
44
 
@@ -1,4 +1,4 @@
1
1
  module I18nScrewdriver
2
- VERSION = "1.2.0"
2
+ VERSION = "2.0.0"
3
3
  end
4
4
 
@@ -65,11 +65,12 @@ namespace :i18n do
65
65
  raise "ERROR: usage: TRANSLATE=de rake i18n:translate" unless ENV['TRANSLATE']
66
66
  locale = ENV['TRANSLATE']
67
67
 
68
+ texts = I18nScrewdriver.load_translations(default_locale)
68
69
  translations = I18nScrewdriver.load_translations(locale)
69
- puts "Translating #{translations.keys.size} entries to <#{locale}> (enter :q to save and quit):"
70
+ puts "Translating #{translations.keys.size} entries from <#{default_locale}> to <#{locale}> (enter :q to save and quit, ctrl-c to abort):"
70
71
  translations.keys.sort.each do |key|
71
- next unless [dummy_text, ""].include?(translations[key])
72
- puts "> #{key}"
72
+ next unless [dummy_text, "", nil].include?(translations[key])
73
+ puts "> #{texts[key]}"
73
74
  input = STDIN.gets.chomp
74
75
  break if input == ":q"
75
76
  translations[key] = input
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_screwdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-31 00:00:00.000000000Z
13
+ date: 2012-06-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: &12479220 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *12479220
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: rails
28
- requirement: &12478240 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,7 +38,12 @@ dependencies:
33
38
  version: 3.0.0
34
39
  type: :runtime
35
40
  prerelease: false
36
- version_requirements: *12478240
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 3.0.0
37
47
  description: make translating with rails i18n fun again
38
48
  email:
39
49
  - agileapplications@gmail.com
@@ -66,15 +76,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
76
  - - ! '>='
67
77
  - !ruby/object:Gem::Version
68
78
  version: '0'
79
+ segments:
80
+ - 0
81
+ hash: 3839915122026581519
69
82
  required_rubygems_version: !ruby/object:Gem::Requirement
70
83
  none: false
71
84
  requirements:
72
85
  - - ! '>='
73
86
  - !ruby/object:Gem::Version
74
87
  version: '0'
88
+ segments:
89
+ - 0
90
+ hash: 3839915122026581519
75
91
  requirements: []
76
92
  rubyforge_project: i18n_screwdriver
77
- rubygems_version: 1.8.10
93
+ rubygems_version: 1.8.24
78
94
  signing_key:
79
95
  specification_version: 3
80
96
  summary: make translating with rails i18n fun again