adhearsion-i18n 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/adhearsion-i18n/plugin.rb +15 -7
- data/lib/adhearsion-i18n/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e08c9f4ccde29b657a1d3623cfb1f3c20a194253
|
4
|
+
data.tar.gz: c9b7261f8bec33d904e4a9c62560cdc8a2fe2c72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f0a1cba2f3edfcdaa09cab5b76e10149cb6983ace1ab0be1f67d3733b5079011dc358badb9e569af71b94fd3fffba458797db903d167ca3a24b597fb629afa
|
7
|
+
data.tar.gz: ecb8432b4dee33f5a6bb1208d8e0bc50a6f50813622cf23ab47ef38c16870358b930da1f15cb67a156ee2bd7969a959cfd2795bf5caef37f6445846a83a57581
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# v0.0.4
|
2
|
+
* [FEATURE] More appropriate log level output and check for empty/broken i18n locales
|
3
|
+
|
1
4
|
# v0.0.3
|
2
5
|
* [FEATURE] Add rake task to validate that all defined audio prompts are found within Adhearsion application
|
3
6
|
* [FEATURE] Allow translation lookups to fallback if an adhearsion-i18n structure isn't found
|
@@ -30,6 +30,7 @@ class AdhearsionI18n::Plugin < Adhearsion::Plugin
|
|
30
30
|
locale_files = Dir.glob(I18n.load_path)
|
31
31
|
|
32
32
|
locale_errors = {}
|
33
|
+
checked_prompts = 0
|
33
34
|
locale_files.each do |locale_file|
|
34
35
|
# We only support YAML for now
|
35
36
|
next unless locale_file =~ /\.ya?ml$/
|
@@ -39,25 +40,32 @@ class AdhearsionI18n::Plugin < Adhearsion::Plugin
|
|
39
40
|
prompts = prompts[locale]
|
40
41
|
|
41
42
|
prompts.each_pair do |key, mapping|
|
43
|
+
logger.trace "Checking i18n key #{key}"
|
42
44
|
# Not all prompts will have audio files
|
43
45
|
next unless mapping['audio']
|
44
46
|
|
47
|
+
|
45
48
|
file = File.absolute_path "#{config['audio_path']}/#{locale}/#{mapping['audio']}"
|
46
49
|
unless File.exist?(file)
|
47
|
-
logger.
|
50
|
+
logger.warn "[#{locale}] Missing audio file: #{file}"
|
48
51
|
locale_errors[locale] ||= 0
|
49
52
|
locale_errors[locale] += 1
|
50
53
|
end
|
54
|
+
checked_prompts += 1
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
54
|
-
if
|
55
|
-
logger.
|
56
|
-
locale_errors.each_pair do |locale, err_count|
|
57
|
-
logger.error "[#{locale}]: #{err_count} missing prompts"
|
58
|
-
end
|
58
|
+
if checked_prompts == 0
|
59
|
+
logger.warn "No adhearsion-i18n prompts found. No files checked."
|
59
60
|
else
|
60
|
-
|
61
|
+
if locale_errors.keys.count > 0
|
62
|
+
logger.error "Errors detected! Number of errors by locale:"
|
63
|
+
locale_errors.each_pair do |locale, err_count|
|
64
|
+
logger.error "[#{locale}]: #{err_count} missing prompts"
|
65
|
+
end
|
66
|
+
else
|
67
|
+
logger.info "All configured prompt files successfully validated."
|
68
|
+
end
|
61
69
|
end
|
62
70
|
end
|
63
71
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adhearsion-i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Klang
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -124,4 +124,3 @@ test_files:
|
|
124
124
|
- spec/fixtures/locale/en.yml
|
125
125
|
- spec/fixtures/locale/it.yml
|
126
126
|
- spec/spec_helper.rb
|
127
|
-
has_rdoc:
|