zendesk_apps_support 1.5.0 → 1.6.0
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.
- data/config/locales/en.yml +3 -5
- data/config/locales/translations/zendesk_apps_support.yml +3 -3
- data/lib/zendesk_apps_support/assets/default_styles.scss +2 -20
- data/lib/zendesk_apps_support/validations/manifest.rb +1 -1
- data/lib/zendesk_apps_support/validations/translations.rb +3 -4
- data/spec/i18n_spec.rb +1 -1
- data/spec/package_spec.rb +1 -1
- data/spec/validations/manifest_spec.rb +1 -1
- data/spec/validations/translations_spec.rb +2 -2
- metadata +2 -2
data/config/locales/en.yml
CHANGED
@@ -21,12 +21,11 @@ en:
|
|
21
21
|
other: ! 'Missing required oauth fields in manifest: %{missing_keys}'
|
22
22
|
missing_source: Could not find app.js
|
23
23
|
style_in_template: <style> tag in %{template}. Use an app.css file instead.
|
24
|
-
invalid_default_locale: ! '%{defaultLocale} is not a valid default locale.
|
25
|
-
Only two- and three-letter ISO 639 language codes are allowed.'
|
24
|
+
invalid_default_locale: ! '%{defaultLocale} is not a valid default locale.'
|
26
25
|
missing_translation_file: ! 'Missing translation file for locale ''%{defaultLocale}''.
|
27
26
|
Please read: http://developer.zendesk.com/documentation/apps/i18n.html'
|
28
27
|
invalid_location:
|
29
|
-
one: ! '%{invalid_locations}
|
28
|
+
one: ! '%{invalid_locations} is an invalid location.'
|
30
29
|
other: ! '%{invalid_locations} are invalid locations.'
|
31
30
|
invalid_hidden_parameter:
|
32
31
|
one: ! '%{invalid_params} is set to hidden and cannot be required.'
|
@@ -36,8 +35,7 @@ en:
|
|
36
35
|
parameters_not_an_array: App parameters must be an array.
|
37
36
|
duplicate_parameters: ! 'Duplicate app parameters defined: %{duplicate_parameters}'
|
38
37
|
translation:
|
39
|
-
invalid_locale: ! '%{file} is not a valid locale.
|
40
|
-
ISO 639 language codes are allowed.'
|
38
|
+
invalid_locale: ! '%{file} is not a valid locale.'
|
41
39
|
not_json: ! '%{file} is not valid JSON. %{errors}'
|
42
40
|
not_json_object: ! '%{file} is not a JSON object.'
|
43
41
|
stylesheet_error: ! 'Sass error: %{sass_error}'
|
@@ -50,7 +50,7 @@ parts:
|
|
50
50
|
- translation:
|
51
51
|
key: "txt.apps.admin.error.app_build.invalid_default_locale"
|
52
52
|
title: "App builder job: invalid default locale"
|
53
|
-
value: "%{defaultLocale} is not a valid default locale.
|
53
|
+
value: "%{defaultLocale} is not a valid default locale."
|
54
54
|
- translation:
|
55
55
|
key: "txt.apps.admin.error.app_build.missing_translation_file"
|
56
56
|
title: "App builder job: missing translation file"
|
@@ -58,7 +58,7 @@ parts:
|
|
58
58
|
- translation:
|
59
59
|
key: "txt.apps.admin.error.app_build.invalid_location.one"
|
60
60
|
title: "App builder job: invalid locations"
|
61
|
-
value: "%{invalid_locations}
|
61
|
+
value: "%{invalid_locations} is an invalid location."
|
62
62
|
- translation:
|
63
63
|
key: "txt.apps.admin.error.app_build.invalid_location.other"
|
64
64
|
title: "App builder job: invalid locations"
|
@@ -90,7 +90,7 @@ parts:
|
|
90
90
|
- translation:
|
91
91
|
key: "txt.apps.admin.error.app_build.translation.invalid_locale"
|
92
92
|
title: "App builder job: invalid locale file name"
|
93
|
-
value: "%{file} is not a valid locale.
|
93
|
+
value: "%{file} is not a valid locale."
|
94
94
|
- translation:
|
95
95
|
key: "txt.apps.admin.error.app_build.translation.not_json"
|
96
96
|
title: "App builder job: translation file is invalid json"
|
@@ -1,21 +1,3 @@
|
|
1
|
-
header {
|
2
|
-
|
3
|
-
|
4
|
-
h3 { line-height: 30px; }
|
5
|
-
hr { margin-top: 0; }
|
6
|
-
|
7
|
-
.logo {
|
8
|
-
background: transparent app-asset-url("logo-small.png") no-repeat;
|
9
|
-
background-size: 25px 25px; float: right; height: 25px; width: 25px;
|
10
|
-
}
|
11
|
-
|
12
|
-
.app-warning-icon {
|
13
|
-
cursor: pointer;
|
14
|
-
float: right;
|
15
|
-
margin-left: 2px;
|
16
|
-
padding: 5px;
|
17
|
-
}
|
1
|
+
header .logo {
|
2
|
+
background-image: app-asset-url("logo-small.png");
|
18
3
|
}
|
19
|
-
|
20
|
-
h3 { font-size: 14px; }
|
21
|
-
footer { background: none; border: 0 }
|
@@ -74,7 +74,7 @@ module ZendeskAppsSupport
|
|
74
74
|
def default_locale_error(manifest, package)
|
75
75
|
default_locale = manifest['defaultLocale']
|
76
76
|
if !default_locale.nil?
|
77
|
-
if default_locale !~
|
77
|
+
if default_locale !~ Translations::VALID_LOCALE
|
78
78
|
ValidationError.new(:invalid_default_locale, :defaultLocale => default_locale)
|
79
79
|
elsif package.translation_files.detect { |file| file.relative_path == "translations/#{default_locale}.json" }.nil?
|
80
80
|
ValidationError.new(:missing_translation_file, :defaultLocale => default_locale)
|
@@ -3,11 +3,10 @@ require 'jshintrb'
|
|
3
3
|
module ZendeskAppsSupport
|
4
4
|
module Validations
|
5
5
|
module Translations
|
6
|
-
|
7
|
-
|
8
|
-
TRANSLATIONS_PATH = %r{^translations/(.*)\.json$}
|
9
|
-
VALID_LOCALE = /^[a-z]{2,3}$/
|
6
|
+
TRANSLATIONS_PATH = %r{^translations/(.*)\.json$}
|
7
|
+
VALID_LOCALE = /^[a-z]{2}(-\w{2,3})?$/
|
10
8
|
|
9
|
+
class << self
|
11
10
|
def call(package)
|
12
11
|
package.files.inject([]) do |errors, file|
|
13
12
|
if path_match = TRANSLATIONS_PATH.match(file.relative_path)
|
data/spec/i18n_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe 'translations' do
|
|
16
16
|
project_root = Pathname.new(File.expand_path('../../', __FILE__))
|
17
17
|
zendesk_version = project_root.join('config/locales/translations/zendesk_apps_support.yml')
|
18
18
|
standard_version = project_root.join('config/locales/en.yml')
|
19
|
-
File.mtime(
|
19
|
+
File.mtime(zendesk_version).should be <= File.mtime(standard_version)
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
data/spec/package_spec.rb
CHANGED
@@ -68,7 +68,7 @@ describe ZendeskAppsSupport::Package do
|
|
68
68
|
email: "john@example.com"
|
69
69
|
},
|
70
70
|
translations: {"app":{\"name\":\"Buddha Machine\"}},
|
71
|
-
templates: {"layout":"<style>\\n.app-0 header
|
71
|
+
templates: {"layout":"<style>\\n.app-0 header .logo {\\n background-image: url(\\"http://localhost:4567/logo-small.png\\"); }\\n.app-0 h1 {\\n color: red; }\\n .app-0 h1 span {\\n color: green; }\\n</style>\\n<header>\\n <span class=\\"logo\\"/>\\n <h3>{{setting \\"name\\"}}</h3>\\n</header>\\n<section data-main/>\\n<footer>\\n <a href=\\"mailto:{{author.email}}\\">\\n {{author.name}}\\n </a>\\n</footer>\\n</div>"},
|
72
72
|
frameworkVersion: "0.5"
|
73
73
|
});
|
74
74
|
|
@@ -35,7 +35,7 @@ describe ZendeskAppsSupport::Validations::Manifest do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should have an error when the defaultLocale is invalid' do
|
38
|
-
manifest = { 'defaultLocale' => 'pt-BR' }
|
38
|
+
manifest = { 'defaultLocale' => 'pt-BR-1' }
|
39
39
|
manifest_file = mock('AppFile', :relative_path => 'manifest.json', :read => JSON.dump(manifest))
|
40
40
|
package = mock('Package', :files => [manifest_file])
|
41
41
|
errors = ZendeskAppsSupport::Validations::Manifest.call(package)
|
@@ -37,7 +37,7 @@ describe ZendeskAppsSupport::Validations::Translations do
|
|
37
37
|
|
38
38
|
context 'when there is a file with an invalid locale for a name' do
|
39
39
|
let(:translation_files) do
|
40
|
-
[ mock('AppFile', :relative_path => 'translations/en-US.json', :read => '{}') ]
|
40
|
+
[ mock('AppFile', :relative_path => 'translations/en-US-1.json', :read => '{}') ]
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should report the error' do
|
@@ -48,7 +48,7 @@ describe ZendeskAppsSupport::Validations::Translations do
|
|
48
48
|
|
49
49
|
context 'when there is a file with a valid locale containing valid JSON' do
|
50
50
|
let(:translation_files) do
|
51
|
-
[ mock('AppFile', :relative_path => 'translations/en.json', :read => '{}') ]
|
51
|
+
[ mock('AppFile', :relative_path => 'translations/en-US.json', :read => '{}') ]
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'should be valid' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_apps_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-10-
|
15
|
+
date: 2013-10-18 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: i18n
|