i18n_check_translations 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzdiMDZmMzVhMThhZmRiMzkwYjdiNzRlMWFlMmMyMDM1NDc2YzIyYQ==
4
+ ZGQzZTRmYTY1NzJlMmIxN2FjMGM2NjgwZTMxOGIyODYwYjg3NmEzMw==
5
5
  data.tar.gz: !binary |-
6
- NmJmOGIwNTBkM2MzYjEwYjI4M2ZkOGY4YmU3ODQzM2UwMmYzNzhlOQ==
6
+ OTcwMTY0ODEzOWRmMDY1MWEzYmY0YzQ3NTM0NmYzMThiOTNiMGM4ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NThmNjcwNjZmOTI0ZjcxMjNjNDM1NGNhNjkwZGNjYjE5YTQzZmY5NWM5OTU4
10
- NzFhMTk0YjUyZWQ1N2Y4MzkwNWIwNDU3OGEyMjJlOGNiNGFhMmE0YmQwZGI4
11
- NjFhZThlYzc3ODA1MThiMThiM2Y0OWRhODhkODQxZWJjYWM0YmQ=
9
+ MzNmMzEwYmFlM2FiZDg5OWNlMGZhMTY3MjI5MzZiNWUyNTgzN2RhZjBmYmQ1
10
+ MTFmMjQ1Mzk1NWUzZjU5ZjlkOTU5NDY5NTc3NTQzYmFhZDYxYTI1Y2EwMzQx
11
+ OTBjZGU1NGRjM2QzZmUxMDE3OTZlMjAzYWYxYzg1ZDhlNTI2YzI=
12
12
  data.tar.gz: !binary |-
13
- NTI2MjM0NDkzODdjZGRmNWI2YjdmMTg3ZmNiZGMxYmNhYTM2MzdhM2VmZDNj
14
- NTQ1MTM0ZmNkNGY2MDJkYmY1ZmFkM2I0NjlkMmNkNmU5OTQxNmM5MWVmY2U0
15
- MTY4YWQzNzMxZDc0MWRhOTFmYjE2ZWZlMmRkMzMxMDVlNzllY2Q=
13
+ NDdlNDc1ODNjYjA3MmI1MzFlN2Q0M2VhMTk4OGVjMGU1ZDk3NWM2MjE1NGVh
14
+ OWI3ZmRkMTJlODQxZDNlNzhkNzVlNGU2YjBlOTM3Mjc1OWI2MmE2YjQ4OWVi
15
+ NWM1ZTBhOGM1MDQxMzFlM2UxMzUzY2ZlZWM0YjQxNzVmZmQwMGE=
data/CHANGELOG CHANGED
@@ -1 +1,3 @@
1
+ v1.1.0. Added an RSpec utility module method that you can include on your RSpec and check for missing translations
2
+
1
3
  v1.0.0. First Release
data/README.md CHANGED
@@ -48,6 +48,27 @@ or, in order words, if you omit the destination translation, task will run once
48
48
  a corresponding file. For example, if your available locales (excluding English in the example) were `:nl` and `:gr` you
49
49
  would get the output in `i18n_check_translations-nl.csv` and in `i18n_check_translations-gr.csv`.
50
50
 
51
+ ### If you are using RSpec
52
+
53
+ ...And you want your specs to check for missing translations and fail for each key missing:
54
+
55
+ 1. Add the following to your `spec_helper`
56
+
57
+ require 'i18n_check_translations_rspec'
58
+
59
+ 2. Write a `spec` file with the following content:
60
+
61
+ (assuming that you want to check against english basic locale)
62
+
63
+ require 'spec_helper'
64
+
65
+ describe 'Check for missing translations' do
66
+ I18nCheckTranslations::RSpec.check_for_missing_translations(self, :en)
67
+ end
68
+
69
+ This will automatically create one example for each english key and will fail for those keys that are missing translation
70
+ in any of the available locales (that are different to the basic locale given).
71
+
51
72
  ## Contributing
52
73
 
53
74
  1. Fork it ( http://github.com/<my-github-username>/i18n_check_translations/fork )
@@ -1,3 +1,3 @@
1
1
  module I18nCheckTranslations
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -0,0 +1,19 @@
1
+ module I18nCheckTranslations
2
+ module RSpec
3
+ # @param example {RSpec::Core::ExampleGroup}
4
+ #
5
+ # Dynamically creates the examples that will check for the keys. One example for each key.
6
+ #
7
+ def self.check_for_missing_translations(example, basic_locale)
8
+ I18n.available_locales.reject {|al| al == basic_locale}.each do |available_locale|
9
+ results = I18nCheckTranslations.check(basic_locale, available_locale)
10
+ results.each do |key, value|
11
+ test_name = "for key: #{key}, in localization_file: #{value[:localization_file]}"
12
+ example.it test_name do
13
+ expect(value[:translation].start_with?('translation missing')).to be_false
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_check_translations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Panayotis Matsinopoulos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-29 00:00:00.000000000 Z
11
+ date: 2014-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,6 +69,7 @@ files:
69
69
  - i18n_check_translations.gemspec
70
70
  - lib/i18n_check_translations.rb
71
71
  - lib/i18n_check_translations/version.rb
72
+ - lib/i18n_check_translations_rspec.rb
72
73
  - lib/tasks/i18n_check_translations.rake
73
74
  - spec/i18n_check_translations_spec.rb
74
75
  - spec/spec_helper.rb