t_t 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e2d2727092a795c91c2ed55be7121285f17fe67
4
- data.tar.gz: c60c9c93024393bc55c3ab325d8bc5c5137dab9a
3
+ metadata.gz: 0df40df4a5c67f19eed54350b348a59d370d2588
4
+ data.tar.gz: 5860c5a87af298eca7f05e9a686a37675dacaaf8
5
5
  SHA512:
6
- metadata.gz: ecb7f85dc79c4ad72f4351f6956b37cb5731af57191c11b6fe7a93fc41053466e9006f8adf183c0dfb025bedb8ec53f06eb83cd6b49ffb7437daef752a72d02c
7
- data.tar.gz: c50045f1db29052474c838ebdcf7ffa0fdb551d4b3922e198f28361d569dfc98eec32863003985b6251c394addba1a07b9cfff492c5591c52c6d59f529e8b713
6
+ metadata.gz: 4c195ec3be7b4542ae36b93ca4bed42b2908d08f389bdefa08637523ba140108e69bb5632a79386bf788699fcc59bca6ebb903ed4758b8b21e66412a848b9b91
7
+ data.tar.gz: 60ad37860ab6f5545163a091e8a8c43d63fe06e3db69c01a3a6559c9842963dadf651fea6eaa16bcf1ffa703851a7adec6db1d8383b635ad7931335c36ec9677
@@ -145,7 +145,7 @@ The generated list of actions is present in the following table:
145
145
  |comment|Neuen Komment hinzufügen|Den Komment bearbeiten|Alle Komments löschen|Добавить комментарий|Изменить комментарий|Удалить комментарии|
146
146
  |list|Neue Liste hinzufügen|Die Liste bearbeiten|Alle Listen löschen|Добавить список|Изменить список|Удалить списки|
147
147
  |log|Neues Protokoll hinzufügen|Das Protokoll bearbeiten|Alle Protokolle löschen|Добавить запись|Изменить запись|Удалить записи|
148
- |person|Neue Person hinzufügen|Die Person bearbeiten|Alle Personen löschen|Добавить персону|Изменить персону|Удалить персон|
148
+ |person|Neue Person hinzufügen|Die Person bearbeiten|Alle Personen löschen|Добавить персону|Изменить персону|Удалить персону|
149
149
 
150
150
  With the factory you get a flexibility in resource renaming - just change of a few lines. A possibility to make a typo
151
151
  in a similar translations down to zero. All shown rules a included in the factory, but not activated.
data/lib/t_t/base.rb CHANGED
@@ -182,4 +182,12 @@ module TT
182
182
 
183
183
  ActiveSupport.run_load_hooks(:tt, self)
184
184
  end
185
+
186
+ module Model
187
+ private
188
+
189
+ def tt
190
+ @tt ||= ::TT.base.new(self.class.to_s)
191
+ end
192
+ end
185
193
  end
data/lib/t_t/i18n_sync.rb CHANGED
@@ -79,7 +79,7 @@ module TT
79
79
 
80
80
  def execute
81
81
  file_updated_at = File.mtime(standard)
82
- return if file_updated_at == @prev_updated_at
82
+ return if defined?(@prev_updated_at) && file_updated_at == @prev_updated_at
83
83
 
84
84
  st_source = Utils.load_file(standard, st_locale)
85
85
  list.each { |l, path| Utils.sync_file(path, l, st_source) }
@@ -92,7 +92,12 @@ module TT
92
92
 
93
93
  Utils.flat_file(standard, st_locale).inject([]) do |list, (k, st_v)|
94
94
  item = flat_list.inject({ st_locale => st_v }) { |r, (l, h)| r.merge!(l => h[k]) }
95
- list << item if item.any? { |l, v| v.nil? }
95
+
96
+ if item.any? { |_, v| v.nil? || v.to_s.include?(MARK) }
97
+ item.each { |l, v| item[l] = nil if v.to_s.include?(MARK) }
98
+ list << item
99
+ end
100
+
96
101
  list
97
102
  end
98
103
  end
data/lib/t_t/tasks.rb CHANGED
@@ -13,7 +13,11 @@ namespace :tt do
13
13
  if sync = TT::Rails.sync
14
14
  sync.missed.each do |group, list|
15
15
  puts "# #{ group }"
16
- puts line.inject("") { |r, (k, v)| r + "#{ k.upcase }: #{ v.to_s.encode('utf-8') }\n" }
16
+
17
+ list.each do |line|
18
+ puts line.inject("") { |r, (k, v)| r + "#{ k.upcase }: #{ v.to_s.encode('utf-8') }\n" }
19
+ end
20
+
17
21
  puts '---'
18
22
  end
19
23
  else
data/t_t.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "t_t"
5
- spec.version = "1.2.0"
5
+ spec.version = "1.2.1"
6
6
  spec.authors = ["Sergey Pchelintsev"]
7
7
  spec.email = ["mail@sergeyp.me"]
8
8
  spec.summary = %q{An opinioned I18n helper}
@@ -78,7 +78,7 @@ describe 'I18n synchronisation' do
78
78
  it 'shows all missed translations' do
79
79
  store = {
80
80
  'en' => { 'a' => 'a', 'b' => 'b', 'c' => { 'd' => 'd' } },
81
- 'de' => { 'b' => 'de-b' }
81
+ 'de' => { 'a' => ':t_t: a', 'b' => 'de-b' }
82
82
  }
83
83
  YAML.stub :load_file, store do
84
84
  sync = TT::I18nSync.new('en', ['en.yml', 'de.yml'])
@@ -0,0 +1,21 @@
1
+ require 'test_helper'
2
+
3
+ describe "the module for services" do
4
+ it 'uses the current class name as namespace' do
5
+ TestClass = Class.new do
6
+ include TT::Model
7
+
8
+ def label
9
+ tt.attr(:label)
10
+ end
11
+
12
+ def human_name
13
+ tt.r
14
+ end
15
+ end
16
+ load_i18n(activerecord: { attributes: { test_class: { label: 'Label' } }, models: { test_class: { one: 'HumanKlass' } } })
17
+ instance = TestClass.new
18
+ assert_equal 'Label', instance.label
19
+ assert_equal 'HumanKlass', instance.human_name
20
+ end
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t_t
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Pchelintsev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -140,6 +140,7 @@ files:
140
140
  - tests/lib/action_pack_test.rb
141
141
  - tests/lib/builtin_rules_test.rb
142
142
  - tests/lib/i18n_sync_test.rb
143
+ - tests/lib/model_module_test.rb
143
144
  - tests/lib/model_test.rb
144
145
  - tests/lib/view_test.rb
145
146
  - tests/test_helper.rb