missing_t 0.3.2 → 0.4.0
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/.gitignore +2 -0
- data/CHANGELOG.md +31 -0
- data/Gemfile.lock +1 -5
- data/bin/missing_t +25 -24
- data/lib/missing_t.rb +91 -94
- data/missing_t.gemspec +0 -1
- data/spec/acceptance/missing_t_spec.rb +12 -0
- data/spec/missing_t_spec.rb +47 -82
- data/spec/support/new.html.erb +31 -0
- metadata +13 -21
- data/CHANGELOG +0 -5
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
0.4.0 (2013-04-06)
|
2
|
+
------------------
|
3
|
+
* No positional command-line arguments
|
4
|
+
|
5
|
+
0.3.2 (2013-03-22)
|
6
|
+
------------------
|
7
|
+
* Add support for haml files
|
8
|
+
|
9
|
+
0.3.1 (2013-02-21)
|
10
|
+
------------------
|
11
|
+
* Make output suitable for copy-pasting into translation files
|
12
|
+
|
13
|
+
0.3.0 (2013-02-07)
|
14
|
+
------------------
|
15
|
+
* Use Bundler for gemspeccing
|
16
|
+
|
17
|
+
0.2.0 (2010-09-11)
|
18
|
+
-----------------
|
19
|
+
* Use Jeweler for gemspeccing
|
20
|
+
|
21
|
+
0.1.2
|
22
|
+
-----
|
23
|
+
* Fix extraction of I18n messages with dynamic key segments
|
24
|
+
|
25
|
+
0.1.1
|
26
|
+
-----
|
27
|
+
* Remove dependencies to ruby-debug and pp.
|
28
|
+
|
29
|
+
0.1.0
|
30
|
+
-----
|
31
|
+
* I am alive!
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
missing_t (0.
|
4
|
+
missing_t (0.4.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
@@ -18,10 +18,7 @@ GEM
|
|
18
18
|
rspec (~> 2.11)
|
19
19
|
listen (0.7.2)
|
20
20
|
lumberjack (1.0.2)
|
21
|
-
metaclass (0.0.1)
|
22
21
|
method_source (0.8.1)
|
23
|
-
mocha (0.13.3)
|
24
|
-
metaclass (~> 0.0.1)
|
25
22
|
pry (0.9.11.4)
|
26
23
|
coderay (~> 1.0.5)
|
27
24
|
method_source (~> 0.8)
|
@@ -46,7 +43,6 @@ DEPENDENCIES
|
|
46
43
|
guard (~> 1.5.4)
|
47
44
|
guard-rspec (~> 2.3.1)
|
48
45
|
missing_t!
|
49
|
-
mocha (~> 0.13.3)
|
50
46
|
rake (~> 10.0.3)
|
51
47
|
rb-fsevent (~> 0.9.1)
|
52
48
|
rspec (~> 2.12.0)
|
data/bin/missing_t
CHANGED
@@ -1,35 +1,36 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
require 'optparse'
|
4
|
+
require_relative '../lib/missing_t'
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
def parse_options(args)
|
7
|
+
options = {}
|
8
|
+
opts = OptionParser.new do |opts|
|
9
|
+
opts.on("-f", "--file FILE_OR_DIR",
|
10
|
+
"Look for missing translations in files under FILE_OR_DIR",
|
11
|
+
"(if a file is given, only look in that file)") do |path|
|
12
|
+
options[:path] = path
|
13
|
+
end
|
14
|
+
opts.on("-l", "--languages LANGUAGES",
|
15
|
+
"Find missing translations for the given languages",
|
16
|
+
"(languages should be given as comma-separated two-char codes)") do |languages|
|
17
|
+
options[:languages] = languages.split(',')
|
12
18
|
end
|
13
19
|
end
|
14
|
-
end
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
print_hash(v, level+1)
|
21
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
22
|
+
puts opts
|
23
|
+
exit
|
20
24
|
end
|
21
|
-
end
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
+
opts.on_tail("--version", "Show version") do
|
27
|
+
puts MissingT::VERSION
|
28
|
+
exit
|
29
|
+
end
|
26
30
|
|
27
|
-
|
28
|
-
|
31
|
+
opts.parse!(args)
|
32
|
+
options
|
29
33
|
end
|
30
34
|
|
31
|
-
|
32
|
-
|
33
|
-
puts "#{language}:"
|
34
|
-
print_hash(missing_for_language, 1)
|
35
|
-
end
|
35
|
+
options = parse_options(ARGV)
|
36
|
+
missing_translations = MissingT.new(options).run
|
data/lib/missing_t.rb
CHANGED
@@ -1,7 +1,21 @@
|
|
1
1
|
require "yaml"
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
|
3
|
+
#TODO: Should I feel about these 'global' helper functions?
|
4
|
+
def hashify(strings)
|
5
|
+
strings.map { |s| s.split('.') }.each_with_object({}) do |segmented_string, h|
|
6
|
+
segmented_string.each do |segment|
|
7
|
+
h[segment] ||= {}
|
8
|
+
h = h[segment]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def print_hash(h, level)
|
14
|
+
h.each_pair do |k,v|
|
15
|
+
puts %(#{" " * (level*2)}#{k}:)
|
16
|
+
print_hash(v, level+1)
|
17
|
+
end
|
18
|
+
end
|
5
19
|
|
6
20
|
class Hash
|
7
21
|
# idea snatched from deep_merge in Rails source code
|
@@ -9,8 +23,8 @@ class Hash
|
|
9
23
|
self.merge(other_hash) do |key, oldval, newval|
|
10
24
|
oldval = oldval.to_hash if oldval.respond_to?(:to_hash)
|
11
25
|
newval = newval.to_hash if newval.respond_to?(:to_hash)
|
12
|
-
if oldval
|
13
|
-
if newval
|
26
|
+
if oldval === Hash
|
27
|
+
if newval === Hash
|
14
28
|
oldval.deep_safe_merge(newval)
|
15
29
|
else
|
16
30
|
oldval
|
@@ -27,20 +41,6 @@ class Hash
|
|
27
41
|
|
28
42
|
end
|
29
43
|
|
30
|
-
module Helpers
|
31
|
-
# snatched from rspec source
|
32
|
-
def colour(text, colour_code)
|
33
|
-
"#{colour_code}#{text}\e[0m"
|
34
|
-
end
|
35
|
-
|
36
|
-
def green(text); colour(text, "\e[32m"); end
|
37
|
-
def red(text); colour(text, "\e[31m"); end
|
38
|
-
def magenta(text); colour(text, "\e[35m"); end
|
39
|
-
def yellow(text); colour(text, "\e[33m"); end
|
40
|
-
def blue(text); colour(text, "\e[34m"); end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
44
|
class MissingT
|
45
45
|
|
46
46
|
class FileReader
|
@@ -51,36 +51,44 @@ class MissingT
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
VERSION = "0.
|
55
|
-
|
56
|
-
include Helpers
|
54
|
+
VERSION = "0.4.0"
|
57
55
|
|
58
|
-
def initialize(
|
59
|
-
@reader = reader
|
56
|
+
def initialize(options={})
|
57
|
+
@reader = options.fetch(:reader, FileReader.new)
|
58
|
+
@languages = options[:languages]
|
59
|
+
@path = options[:path]
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
63
|
-
|
64
|
-
|
65
|
-
opts = OptionParser.new do |opts|
|
66
|
-
opts.on("-f", "--file FILE_OR_DIR",
|
67
|
-
"look for missing translations in files under FILE_OR_DIR",
|
68
|
-
"(if a file is given, only look in that file)") do |path|
|
69
|
-
@options.path = path
|
70
|
-
end
|
71
|
-
end
|
62
|
+
def run
|
63
|
+
missing_translations = collect
|
64
|
+
missing_message_strings = missing_translations.values.map { |ms| hashify(ms) }
|
72
65
|
|
73
|
-
|
74
|
-
|
75
|
-
exit
|
66
|
+
missing = missing_message_strings.each_with_object({}) do |h, all_message_strings|
|
67
|
+
all_message_strings.deep_safe_merge!(h)
|
76
68
|
end
|
77
69
|
|
78
|
-
|
79
|
-
puts
|
80
|
-
|
70
|
+
missing.each do |language, missing_for_language|
|
71
|
+
puts
|
72
|
+
puts "#{language}:"
|
73
|
+
print_hash(missing_for_language, 1)
|
81
74
|
end
|
75
|
+
end
|
82
76
|
|
83
|
-
|
77
|
+
def collect
|
78
|
+
ts = translation_keys
|
79
|
+
#TODO: If no translation keys were found and the languages were not given explicitly
|
80
|
+
# issue a warning and bail out
|
81
|
+
languages = @languages ? @languages : ts.keys
|
82
|
+
get_missing_translations(translation_keys, translation_queries, languages)
|
83
|
+
end
|
84
|
+
|
85
|
+
def get_missing_translations(keys, queries, languages)
|
86
|
+
languages.each_with_object({}) do |lang, missing|
|
87
|
+
get_missing_translations_for_lang(keys, queries, lang).each do |file, queries|
|
88
|
+
missing[file] ||= []
|
89
|
+
missing[file].concat(queries).uniq!
|
90
|
+
end
|
91
|
+
end
|
84
92
|
end
|
85
93
|
|
86
94
|
def translation_keys
|
@@ -93,14 +101,37 @@ class MissingT
|
|
93
101
|
end
|
94
102
|
end
|
95
103
|
|
104
|
+
def translation_queries
|
105
|
+
files_with_i18n_queries.each_with_object({}) do |file, queries|
|
106
|
+
queries_in_file = extract_i18n_queries(file)
|
107
|
+
if queries_in_file.any?
|
108
|
+
queries[file] = queries_in_file
|
109
|
+
end
|
110
|
+
end
|
111
|
+
#TODO: remove duplicate queries across files
|
112
|
+
end
|
113
|
+
|
114
|
+
def has_translation?(keys, lang, query)
|
115
|
+
i18n_label(lang, query).split('.').each do |segment|
|
116
|
+
return false unless segment =~ /#\{.*\}/ or (keys.respond_to?(:key?) and keys.key?(segment))
|
117
|
+
keys = keys[segment]
|
118
|
+
end
|
119
|
+
true
|
120
|
+
end
|
121
|
+
|
96
122
|
def files_with_i18n_queries
|
97
|
-
if
|
98
|
-
path = path
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
123
|
+
if @path
|
124
|
+
path = File.expand_path(@path)
|
125
|
+
if File.file?(path)
|
126
|
+
[@path]
|
127
|
+
else
|
128
|
+
path.chomp!('/')
|
129
|
+
[
|
130
|
+
Dir.glob("#{path}/**/*.erb"),
|
131
|
+
Dir.glob("#{path}/**/*.haml"),
|
132
|
+
Dir.glob("#{path}/**/*.rb")
|
133
|
+
]
|
134
|
+
end
|
104
135
|
else
|
105
136
|
[
|
106
137
|
Dir.glob("app/**/*.erb"),
|
@@ -116,61 +147,27 @@ class MissingT
|
|
116
147
|
i18n_query_pattern = /[^\w]+(?:I18n\.translate|I18n\.t|translate|t)\s*\((.*?)[,\)]/
|
117
148
|
i18n_query_no_parens_pattern = /[^\w]+(?:I18n\.translate|I18n\.t|translate|t)\s+(['"])(.*?)\1/
|
118
149
|
|
119
|
-
@reader.read(file) do |content|
|
150
|
+
@reader.read(File.expand_path(file)) do |content|
|
120
151
|
([]).tap do |i18n_message_strings|
|
121
|
-
i18n_message_strings
|
122
|
-
i18n_message_strings
|
123
|
-
end.flatten
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def translation_queries
|
128
|
-
files_with_i18n_queries.each_with_object({}) do |file, queries|
|
129
|
-
queries_in_file = extract_i18n_queries(file)
|
130
|
-
if queries_in_file.any?
|
131
|
-
queries[file] = queries_in_file
|
152
|
+
i18n_message_strings.concat content.scan(i18n_query_pattern).map { |match| match[0].gsub(/['"\s]/, '') }
|
153
|
+
i18n_message_strings.concat content.scan(i18n_query_no_parens_pattern).map { |match| match[1].gsub(/['"\s]/, '') }
|
132
154
|
end
|
133
155
|
end
|
134
|
-
#TODO: remove duplicate queries across files
|
135
156
|
end
|
136
157
|
|
137
|
-
|
138
|
-
i18n_label(lang, query).split('.').each do |segment|
|
139
|
-
return false unless segment =~ /#\{.*\}/ or (keys.respond_to?(:key?) and keys.key?(segment))
|
140
|
-
keys = keys[segment]
|
141
|
-
end
|
142
|
-
true
|
143
|
-
end
|
158
|
+
private
|
144
159
|
|
145
|
-
def
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
160
|
+
def get_missing_translations_for_lang(keys, queries, lang)
|
161
|
+
queries.map do |file, queries_in_file|
|
162
|
+
queries_with_no_translation = queries_in_file.reject { |q| has_translation?(keys, lang, q) }
|
163
|
+
if queries_with_no_translation.any?
|
164
|
+
[file, queries_with_no_translation.map { |q| i18n_label(lang, q) }]
|
150
165
|
end
|
151
|
-
end
|
166
|
+
end.compact
|
152
167
|
end
|
153
168
|
|
154
|
-
def
|
155
|
-
|
156
|
-
get_missing_translations(translation_keys, translation_queries, lang ? [lang] : ts.keys)
|
169
|
+
def i18n_label(lang, query)
|
170
|
+
"#{lang}.#{query}"
|
157
171
|
end
|
158
172
|
|
159
|
-
private
|
160
|
-
def get_missing_translations_for_lang(keys, queries, lang)
|
161
|
-
queries.map do |file, queries_in_file|
|
162
|
-
queries_with_no_translation = queries_in_file.select { |q| !has_translation?(keys, lang, q) }
|
163
|
-
if queries_with_no_translation.empty?
|
164
|
-
nil
|
165
|
-
else
|
166
|
-
[file, queries_with_no_translation.map { |q| i18n_label(lang, q) }]
|
167
|
-
end
|
168
|
-
end.compact
|
169
|
-
|
170
|
-
end
|
171
|
-
|
172
|
-
def i18n_label(lang, query)
|
173
|
-
"#{lang}.#{query}"
|
174
|
-
end
|
175
|
-
|
176
173
|
end
|
data/missing_t.gemspec
CHANGED
@@ -23,5 +23,4 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_development_dependency 'guard', ['~> 1.5.4']
|
24
24
|
gem.add_development_dependency 'guard-rspec', ['~> 2.3.1']
|
25
25
|
gem.add_development_dependency 'rb-fsevent', ['~> 0.9.1']
|
26
|
-
gem.add_development_dependency 'mocha', ['~> 0.13.3']
|
27
26
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe "MissingT" do
|
4
|
+
describe "correctly finds all missing translations" do
|
5
|
+
m = MissingT.new({ languages: ["en"], path: "spec/support/new.html.erb" })
|
6
|
+
m.collect['spec/support/new.html.erb'].should =~ [
|
7
|
+
"en.flights.new.new_flight", "en.flights.new.name", "en.flights.new.capacity",
|
8
|
+
"en.flights.new.duration", "en.flights.new.from", "en.flights.new.to",
|
9
|
+
"en.flights.new.create", "en.flights.new.back"
|
10
|
+
]
|
11
|
+
end
|
12
|
+
end
|
data/spec/missing_t_spec.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
# use mocha for mocking instead of
|
4
|
-
# Rspec's own mock framework
|
5
|
-
RSpec.configure do |config|
|
6
|
-
config.mock_with :mocha
|
7
|
-
end
|
8
|
-
|
9
3
|
class ContentReader
|
10
4
|
def read(content)
|
11
5
|
yield content
|
@@ -14,7 +8,7 @@ end
|
|
14
8
|
|
15
9
|
describe "MissingT" do
|
16
10
|
before do
|
17
|
-
@missing_t = MissingT.new(ContentReader.new)
|
11
|
+
@missing_t = MissingT.new(reader: ContentReader.new)
|
18
12
|
@es_translations = {"es"=>
|
19
13
|
{"zoo"=>{"elephant"=>"elefante", "bear"=>"oso", "lion"=>"leon", "bee" => "abeja"},
|
20
14
|
"lamp"=>"lampa",
|
@@ -33,34 +27,54 @@ describe "MissingT" do
|
|
33
27
|
end
|
34
28
|
|
35
29
|
describe "the i18n query extracion" do
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
30
|
+
describe "when the translation function is called as I18n.t" do
|
31
|
+
it "should correctly extract the key" do
|
32
|
+
content = <<-EOS
|
33
|
+
<div class="title_gray"><span><%= I18n.t("anetcom.member.projects.new.page_title") %></span></div>
|
34
|
+
EOS
|
35
|
+
@missing_t.extract_i18n_queries(content).should == ["anetcom.member.projects.new.page_title"]
|
36
|
+
end
|
37
|
+
it "should correctly extract the key not right after the <%= mark" do
|
38
|
+
content = <<-EOS
|
39
|
+
<%= submit_tag I18n.t('anetcom.member.projects.new.create_project'), :class => 'button' %>
|
40
|
+
EOS
|
41
|
+
@missing_t.extract_i18n_queries(content).should == ["anetcom.member.projects.new.create_project"]
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should correctly extract the key when there is an argument in the call" do
|
45
|
+
content = <<-EOS
|
46
|
+
:html => {:title => I18n.t("tog_social.sharing.share_with", :name => shared.name)}
|
47
|
+
EOS
|
48
|
+
@missing_t.extract_i18n_queries(content).should == ["tog_social.sharing.share_with"]
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should find and correctly extract a dynamic key translation message" do
|
52
|
+
content = %q(<div class="title_gray"><span><%= I18n.t("mycompany.welcome.#{key}") %></span></div>)
|
53
|
+
@missing_t.extract_i18n_queries(content).should == [%q(mycompany.welcome.#{key})]
|
54
|
+
end
|
57
55
|
end
|
58
56
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
57
|
+
describe "when the translation function is called as t" do
|
58
|
+
it "should correctly extract the key" do
|
59
|
+
content = <<-EOS
|
60
|
+
<div class="title_gray"><span><%= t("anetcom.member.projects.new.page_title") %></span></div>
|
61
|
+
EOS
|
62
|
+
@missing_t.extract_i18n_queries(content).should == ["anetcom.member.projects.new.page_title"]
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should find several messages on the same line" do
|
66
|
+
content = <<-EOS
|
67
|
+
<div class="title_gray"><span><%= t("anetcom.member.projects.new.page_title") %></span><span>t("anetcom.member.projects.new.page_size")</span></div>
|
68
|
+
EOS
|
69
|
+
@missing_t.extract_i18n_queries(content).should == ["anetcom.member.projects.new.page_title", "anetcom.member.projects.new.page_size"]
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should find messages with a parens-less call" do
|
73
|
+
content = <<-EOS
|
74
|
+
<div class="title_gray"><span><%= t "anetcom.member.projects.new.page_title" %></span></div>
|
75
|
+
EOS
|
76
|
+
@missing_t.extract_i18n_queries(content).should == ["anetcom.member.projects.new.page_title"]
|
77
|
+
end
|
64
78
|
end
|
65
79
|
|
66
80
|
it "should correctly extract the I18n.translate type of messages" do
|
@@ -70,27 +84,6 @@ describe "MissingT" do
|
|
70
84
|
@missing_t.extract_i18n_queries(content).should == ["anetcom.member.projects.new.page_title"]
|
71
85
|
end
|
72
86
|
|
73
|
-
it "should correctly extract the t type of messages" do
|
74
|
-
content = <<-EOS
|
75
|
-
<div class="title_gray"><span><%= t("anetcom.member.projects.new.page_title") %></span></div>
|
76
|
-
EOS
|
77
|
-
@missing_t.extract_i18n_queries(content).should == ["anetcom.member.projects.new.page_title"]
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should find several messages on the same line" do
|
81
|
-
content = <<-EOS
|
82
|
-
<div class="title_gray"><span><%= t("anetcom.member.projects.new.page_title") %></span><span>t("anetcom.member.projects.new.page_size")</span></div>
|
83
|
-
EOS
|
84
|
-
@missing_t.extract_i18n_queries(content).should == ["anetcom.member.projects.new.page_title", "anetcom.member.projects.new.page_size"]
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should find messages with a parens-less call" do
|
88
|
-
content = <<-EOS
|
89
|
-
<div class="title_gray"><span><%= t "anetcom.member.projects.new.page_title" %></span></div>
|
90
|
-
EOS
|
91
|
-
@missing_t.extract_i18n_queries(content).should == ["anetcom.member.projects.new.page_title"]
|
92
|
-
end
|
93
|
-
|
94
87
|
it "should not extract a function call that just ends in t" do
|
95
88
|
content = <<-EOS
|
96
89
|
<div class="title_gray"><span><%= at(3) %></span></div>
|
@@ -98,33 +91,5 @@ describe "MissingT" do
|
|
98
91
|
@missing_t.extract_i18n_queries(content).should == []
|
99
92
|
end
|
100
93
|
|
101
|
-
it "should find and correctly extract a dynamic key translation message" do
|
102
|
-
content = %q(<div class="title_gray"><span><%= I18n.t("mycompany.welcome.#{key}") %></span></div>)
|
103
|
-
@missing_t.extract_i18n_queries(content).should == [%q(mycompany.welcome.#{key})]
|
104
|
-
end
|
105
|
-
|
106
94
|
end
|
107
|
-
|
108
|
-
describe "finding missing translations" do
|
109
|
-
before do
|
110
|
-
@t_queries = { :fake_file => ["mother", "zoo.bee", "zoo.wasp", "pen"] }
|
111
|
-
@missing_t.stubs(:translation_keys).returns(@fr_translations.merge(@es_translations))
|
112
|
-
@missing_t.stubs(:translation_queries).returns(@t_queries)
|
113
|
-
end
|
114
|
-
|
115
|
-
it "should correctly get missing translations for a specific language" do
|
116
|
-
miss_entries = @missing_t.find_missing_translations("fr").map{ |e| e[1] }.flatten
|
117
|
-
miss_entries.should include("fr.pen")
|
118
|
-
miss_entries.should include("fr.zoo.bee")
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should correctly get missing translations" do
|
122
|
-
miss_entries = @missing_t.find_missing_translations.map{ |e| e[1] }.flatten
|
123
|
-
miss_entries.should include("fr.zoo.bee")
|
124
|
-
miss_entries.should include("fr.pen")
|
125
|
-
miss_entries.should include("es.zoo.wasp")
|
126
|
-
miss_entries.should include("es.mother")
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
95
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<h1><%= I18n.t("flights.new.new_flight", :default => "New flight") %></h1>
|
2
|
+
|
3
|
+
<% form_for(@flight) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= f.label I18n.t("flights.new.name", :default => "name") %><br />
|
8
|
+
<%= f.text_field :name %>
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
<%= f.label I18n.t("flights.new.capacity", :default => "capacity") %><br />
|
12
|
+
<%= f.text_field :capacity %>
|
13
|
+
</p>
|
14
|
+
<p>
|
15
|
+
<%= f.label I18n.t("flights.new.duration", :default => "duration") %><br />
|
16
|
+
<%= f.text_field :duration %>
|
17
|
+
</p>
|
18
|
+
<p>
|
19
|
+
<%= f.label :from_id, I18n.t("flights.new.from", :default => "From") %><br />
|
20
|
+
<%= f.select :from_id, @airport_options %>
|
21
|
+
</p>
|
22
|
+
<p>
|
23
|
+
<%= f.label :to_id, I18n.t("flights.new.to", :default => "To") %><br />
|
24
|
+
<%= f.select :to_id, @airport_options %>
|
25
|
+
</p>
|
26
|
+
<p>
|
27
|
+
<%= f.submit I18n.t("flights.new.create", :default => 'Create') %>
|
28
|
+
</p>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<%= link_to I18n.t("flights.new.back", :default => 'Back'), flights_path %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: missing_t
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -91,22 +91,6 @@ dependencies:
|
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: 0.9.1
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: mocha
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: 0.13.3
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 0.13.3
|
110
94
|
description: Finds all the missing i18n translations in your Rails project
|
111
95
|
email:
|
112
96
|
- balint.erdi@gmail.com
|
@@ -119,7 +103,7 @@ files:
|
|
119
103
|
- !binary |-
|
120
104
|
LmdpdGlnbm9yZQ==
|
121
105
|
- !binary |-
|
122
|
-
|
106
|
+
Q0hBTkdFTE9HLm1k
|
123
107
|
- !binary |-
|
124
108
|
R2VtZmlsZQ==
|
125
109
|
- !binary |-
|
@@ -142,10 +126,14 @@ files:
|
|
142
126
|
bGliL21pc3NpbmdfdC5yYg==
|
143
127
|
- !binary |-
|
144
128
|
bWlzc2luZ190LmdlbXNwZWM=
|
129
|
+
- !binary |-
|
130
|
+
c3BlYy9hY2NlcHRhbmNlL21pc3NpbmdfdF9zcGVjLnJi
|
145
131
|
- !binary |-
|
146
132
|
c3BlYy9taXNzaW5nX3Rfc3BlYy5yYg==
|
147
133
|
- !binary |-
|
148
134
|
c3BlYy9zcGVjX2hlbHBlci5yYg==
|
135
|
+
- !binary |-
|
136
|
+
c3BlYy9zdXBwb3J0L25ldy5odG1sLmVyYg==
|
149
137
|
- !binary |-
|
150
138
|
dGFza3MvbWlzc2luZ190LnJha2U=
|
151
139
|
- !binary |-
|
@@ -164,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
152
|
version: '0'
|
165
153
|
segments:
|
166
154
|
- 0
|
167
|
-
hash:
|
155
|
+
hash: 1881571199484440278
|
168
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
157
|
none: false
|
170
158
|
requirements:
|
@@ -173,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
161
|
version: '0'
|
174
162
|
segments:
|
175
163
|
- 0
|
176
|
-
hash:
|
164
|
+
hash: 1881571199484440278
|
177
165
|
requirements: []
|
178
166
|
rubyforge_project:
|
179
167
|
rubygems_version: 1.8.23
|
@@ -181,7 +169,11 @@ signing_key:
|
|
181
169
|
specification_version: 3
|
182
170
|
summary: Finds all the missing i18n translations in your Rails project
|
183
171
|
test_files:
|
172
|
+
- !binary |-
|
173
|
+
c3BlYy9hY2NlcHRhbmNlL21pc3NpbmdfdF9zcGVjLnJi
|
184
174
|
- !binary |-
|
185
175
|
c3BlYy9taXNzaW5nX3Rfc3BlYy5yYg==
|
186
176
|
- !binary |-
|
187
177
|
c3BlYy9zcGVjX2hlbHBlci5yYg==
|
178
|
+
- !binary |-
|
179
|
+
c3BlYy9zdXBwb3J0L25ldy5odG1sLmVyYg==
|