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 +8 -8
- data/CHANGELOG +2 -0
- data/README.md +21 -0
- data/lib/i18n_check_translations/version.rb +1 -1
- data/lib/i18n_check_translations_rspec.rb +19 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGQzZTRmYTY1NzJlMmIxN2FjMGM2NjgwZTMxOGIyODYwYjg3NmEzMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTcwMTY0ODEzOWRmMDY1MWEzYmY0YzQ3NTM0NmYzMThiOTNiMGM4ZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzNmMzEwYmFlM2FiZDg5OWNlMGZhMTY3MjI5MzZiNWUyNTgzN2RhZjBmYmQ1
|
10
|
+
MTFmMjQ1Mzk1NWUzZjU5ZjlkOTU5NDY5NTc3NTQzYmFhZDYxYTI1Y2EwMzQx
|
11
|
+
OTBjZGU1NGRjM2QzZmUxMDE3OTZlMjAzYWYxYzg1ZDhlNTI2YzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDdlNDc1ODNjYjA3MmI1MzFlN2Q0M2VhMTk4OGVjMGU1ZDk3NWM2MjE1NGVh
|
14
|
+
OWI3ZmRkMTJlODQxZDNlNzhkNzVlNGU2YjBlOTM3Mjc1OWI2MmE2YjQ4OWVi
|
15
|
+
NWM1ZTBhOGM1MDQxMzFlM2UxMzUzY2ZlZWM0YjQxNzVmZmQwMGE=
|
data/CHANGELOG
CHANGED
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 )
|
@@ -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.
|
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-
|
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
|