afalkear_translation_center 1.8.0 → 1.8.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: 420d7e13eadfb8aad5dae6873edf416a5109913a
4
- data.tar.gz: 198f2dd0148a15aaef1bfa1170b7df6de08f1bb2
3
+ metadata.gz: 69646acdae5b7eabc0f728139b1b7db558b2790f
4
+ data.tar.gz: 49fdadb4ee9876aaa7f6eb690615891fc876fd33
5
5
  SHA512:
6
- metadata.gz: e749c089524e27fd40a2fd0359c937c2cdab92bb8b37f42e05650885c2c2a0dca2ee4b3e83997e3b6e3b75138fc38ea62526ad591e6fcd5f6fb71d08f894e3d1
7
- data.tar.gz: 91eb6fa3542d9cc4ddf8322c4f457065c471c183db46e5ff90775ca24d1c37bdc2ec6581fc970d22c9dc63eb73e8fcbd4505bb231616ba3aab2260ebd382cb9b
6
+ metadata.gz: fc157974813ccb4676582850ed8c96c648597267c4e0fe52faa8f0577935974db2fd68ac59f0b1c6fb2337c2037a59cbf5c5af4b08c21ab44b011e16e2e77279
7
+ data.tar.gz: cf13aa6718f7e325b3dbcd6632080b0dbe565a9cd96308b388ce75d2a2fa760ac35b1e5de8464a4612c5b5831e97ef671505ba51fa4b45bfd79ddbf9832809fe
@@ -23,7 +23,8 @@ function attachInspectorLinks(){
23
23
  var id = $(this).data('id');
24
24
  // missing translation will be in red while translated will be in green
25
25
  var badgeClass = getBadge($(this).data('type'));
26
- $('#tc-inspector-links').append($('<a>').attr('title', 'Click to visit key').attr('target', 'key_inspect').attr('href', translation_center_translation_key_path(id) + "?lang_to=" + $(this).data('locale')).attr('data-id', id).attr('style', 'left:' + left + 'px;top:' + top + 'px' ).attr('class', 'icon-edit tc-badge ' + badgeClass + ' tc-inspector-link'));
26
+ var link = $('#tc-inspector-links').append($('<a>').attr('title', 'Click to visit key').attr('target', 'key_inspect').attr('href', translation_center_translation_key_path(id) + "?lang_to=" + $(this).data('locale')).attr('data-id', id).attr('style', 'left:' + left + 'px;top:' + top + 'px' ).attr('class', 'icon-edit tc-badge ' + badgeClass + ' tc-inspector-link'));
27
+ link.children(":last-child").append('<i class="fa fa-pencil-square-o"></i>');
27
28
 
28
29
  });
29
30
 
@@ -30,7 +30,7 @@ development:
30
30
  inspector: 'missing' # default missing
31
31
 
32
32
  # I18n.translate source
33
- i18n_source: 'db' # can be db or yaml; default is db
33
+ i18n_source: 'yaml' # can be db or yaml; default is db
34
34
 
35
35
  # when a new key is added to db, the value of the key is added as the default translation in English
36
36
  save_default_translation: true
@@ -60,7 +60,7 @@ module TranslationCenter
60
60
  complete_key = prepare_key(key, options) # prepare complete key
61
61
 
62
62
  # add the new key or update it
63
- translation_key = TranslationCenter::TranslationKey.find_or_create_by_name(complete_key)
63
+ translation_key = TranslationCenter::TranslationKey.find_or_create_by(name: complete_key)
64
64
  # UNCOMMENT THIS LATER TO SET LAST ACCESSED AT
65
65
  # translation_key.update_attribute(:last_accessed, Time.now)
66
66
 
@@ -74,10 +74,14 @@ module TranslationCenter
74
74
  options.each_pair{ |key, value| val.gsub!("%{#{key.to_s}}", value.to_s) } if val.is_a?(String)
75
75
 
76
76
  if val.blank? && !translation_key.has_children?
77
+ # if the key has no translation show the key last identifier to modify
77
78
  throw(:exception, I18n::MissingTranslation.new(locale, complete_key, options))
79
+ #translation_value = key.split('.').last
80
+ #return wrap_span(translation_value, translation_key)
78
81
  elsif translation_key.has_children?
79
82
  # TODO should use ancestors for keys
80
- return translation_key.children_translations(locale)
83
+ #return translation_key.children_translations(locale)
84
+ return wrap_span(translation_key.children_translations(locale), translation_key)
81
85
  end
82
86
  wrap_span(val, translation_key)
83
87
  else
@@ -113,7 +117,6 @@ module I18n
113
117
  translation_key = keys
114
118
  # remove locale
115
119
  translation_key.shift
116
-
117
120
  translation_key = TranslationCenter::TranslationKey.find_by_name(translation_key.join('.'))
118
121
  # don't put the inspector class if inspector is off or the key belongs to translation_center
119
122
  if TranslationCenter::CONFIG['inspector'] == 'off' || category == 'translation_center'
@@ -1,3 +1,3 @@
1
1
  module TranslationCenter
2
- VERSION = "1.8.0"
2
+ VERSION = "1.8.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: afalkear_translation_center
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - afalkear
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-25 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails