ad_space 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +33 -1
- data/ad_space.gemspec +1 -3
- data/app/controllers/ad_space/advertisements_controller.rb +6 -3
- data/app/controllers/ad_space/api/v1/advertisements_controller.rb +21 -9
- data/app/controllers/ad_space/application_controller.rb +34 -0
- data/app/controllers/ad_space/slots_controller.rb +6 -3
- data/app/models/ad_space/i18n_config.rb +25 -0
- data/app/views/ad_space/advertisements/_advertisement.html.erb +0 -15
- data/app/views/ad_space/advertisements/_form.html.erb +6 -6
- data/app/views/ad_space/advertisements/edit.html.erb +3 -3
- data/app/views/ad_space/advertisements/index.html.erb +3 -3
- data/app/views/ad_space/advertisements/new.html.erb +2 -2
- data/app/views/ad_space/advertisements/show.html.erb +5 -5
- data/app/views/ad_space/dashboard/index.html.erb +4 -4
- data/app/views/ad_space/slots/_form.html.erb +4 -4
- data/app/views/ad_space/slots/_slot.html.erb +5 -5
- data/app/views/ad_space/slots/edit.html.erb +3 -3
- data/app/views/ad_space/slots/index.html.erb +3 -3
- data/app/views/ad_space/slots/new.html.erb +2 -2
- data/app/views/ad_space/slots/show.html.erb +3 -3
- data/bin/rails +14 -0
- data/config/i18n-tasks.yml +155 -0
- data/config/locales/zh-CN.yml +240 -0
- data/lib/ad_space/configuration.rb +5 -0
- data/lib/ad_space/version.rb +1 -1
- data/public/ad_space-assets/application.js +31 -0
- data/public/ad_space-assets/application.js.map +7 -0
- metadata +8 -2
@@ -0,0 +1,155 @@
|
|
1
|
+
# i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
|
2
|
+
|
3
|
+
# The "main" locale.
|
4
|
+
base_locale: zh-CN
|
5
|
+
## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
|
6
|
+
# locales: [es, fr]
|
7
|
+
## Reporting locale, default: en. Available: en, ru.
|
8
|
+
# internal_locale: en
|
9
|
+
|
10
|
+
# Read and write translations.
|
11
|
+
data:
|
12
|
+
## Translations are read from the file system. Supported format: YAML, JSON.
|
13
|
+
## Provide a custom adapter:
|
14
|
+
# adapter: I18n::Tasks::Data::FileSystem
|
15
|
+
|
16
|
+
# Locale files or `Find.find` patterns where translations are read from:
|
17
|
+
read:
|
18
|
+
## Default:
|
19
|
+
# - config/locales/%{locale}.yml
|
20
|
+
## More files:
|
21
|
+
# - config/locales/**/*.%{locale}.yml
|
22
|
+
|
23
|
+
# Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
|
24
|
+
# `i18n-tasks normalize -p` will force move the keys according to these rules
|
25
|
+
write:
|
26
|
+
## For example, write devise and simple form keys to their respective files:
|
27
|
+
# - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
|
28
|
+
## Catch-all default:
|
29
|
+
# - config/locales/%{locale}.yml
|
30
|
+
|
31
|
+
# External locale data (e.g. gems).
|
32
|
+
# This data is not considered unused and is never written to.
|
33
|
+
external:
|
34
|
+
## Example (replace %#= with %=):
|
35
|
+
# - "<%#= %x[bundle info vagrant --path].chomp %>/templates/locales/%{locale}.yml"
|
36
|
+
|
37
|
+
## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, or a custom class.
|
38
|
+
# router: conservative_router
|
39
|
+
|
40
|
+
yaml:
|
41
|
+
write:
|
42
|
+
# do not wrap lines at 80 characters
|
43
|
+
line_width: -1
|
44
|
+
|
45
|
+
## Pretty-print JSON:
|
46
|
+
# json:
|
47
|
+
# write:
|
48
|
+
# indent: ' '
|
49
|
+
# space: ' '
|
50
|
+
# object_nl: "\n"
|
51
|
+
# array_nl: "\n"
|
52
|
+
|
53
|
+
# Find translate calls
|
54
|
+
search:
|
55
|
+
## Paths or `Find.find` patterns to search in:
|
56
|
+
# paths:
|
57
|
+
# - app/
|
58
|
+
|
59
|
+
## Root directories for relative keys resolution.
|
60
|
+
# relative_roots:
|
61
|
+
# - app/controllers
|
62
|
+
# - app/helpers
|
63
|
+
# - app/mailers
|
64
|
+
# - app/presenters
|
65
|
+
# - app/views
|
66
|
+
|
67
|
+
## Directories where method names which should not be part of a relative key resolution.
|
68
|
+
# By default, if a relative translation is used inside a method, the name of the method will be considered part of the resolved key.
|
69
|
+
# Directories listed here will not consider the name of the method part of the resolved key
|
70
|
+
#
|
71
|
+
# relative_exclude_method_name_paths:
|
72
|
+
# -
|
73
|
+
|
74
|
+
## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
|
75
|
+
## *.jpg *.jpeg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less
|
76
|
+
## *.yml *.json *.zip *.tar.gz *.swf *.flv *.mp3 *.wav *.flac *.webm *.mp4 *.ogg *.opus *.webp *.map *.xlsx
|
77
|
+
exclude:
|
78
|
+
- app/assets/images
|
79
|
+
- app/assets/fonts
|
80
|
+
- app/assets/videos
|
81
|
+
- app/assets/builds
|
82
|
+
|
83
|
+
## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
|
84
|
+
## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
|
85
|
+
# only: ["*.rb", "*.html.slim"]
|
86
|
+
|
87
|
+
## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`.
|
88
|
+
# strict: true
|
89
|
+
|
90
|
+
## Allows adding ast_matchers for finding translations using the AST-scanners
|
91
|
+
## The available matchers are:
|
92
|
+
## - RailsModelMatcher
|
93
|
+
## Matches ActiveRecord translations like
|
94
|
+
## User.human_attribute_name(:email) and User.model_name.human
|
95
|
+
##
|
96
|
+
## To implement your own, please see `I18n::Tasks::Scanners::AstMatchers::BaseMatcher`.
|
97
|
+
# <%# I18n::Tasks.add_ast_matcher('I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher') %>
|
98
|
+
|
99
|
+
## Multiple scanners can be used. Their results are merged.
|
100
|
+
## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
|
101
|
+
## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example
|
102
|
+
|
103
|
+
## Translation Services
|
104
|
+
# translation:
|
105
|
+
# # Google Translate
|
106
|
+
# # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
|
107
|
+
# google_translate_api_key: "AbC-dEf5"
|
108
|
+
# # DeepL Pro Translate
|
109
|
+
# # Get an API key and subscription at https://www.deepl.com/pro to use DeepL Pro
|
110
|
+
# deepl_api_key: "48E92789-57A3-466A-9959-1A1A1A1A1A1A"
|
111
|
+
# # deepl_host: "https://api.deepl.com"
|
112
|
+
# # deepl_version: "v2"
|
113
|
+
# # add additional options to the DeepL.translate call: https://www.deepl.com/docs-api/translate-text/translate-text/
|
114
|
+
# deepl_options:
|
115
|
+
# formality: prefer_less
|
116
|
+
## Do not consider these keys missing:
|
117
|
+
# ignore_missing:
|
118
|
+
# - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
|
119
|
+
# - '{devise,simple_form}.*'
|
120
|
+
|
121
|
+
## Consider these keys used:
|
122
|
+
# ignore_unused:
|
123
|
+
# - 'activerecord.attributes.*'
|
124
|
+
# - '{devise,kaminari,will_paginate}.*'
|
125
|
+
# - 'simple_form.{yes,no}'
|
126
|
+
# - 'simple_form.{placeholders,hints,labels}.*'
|
127
|
+
# - 'simple_form.{error_notification,required}.:'
|
128
|
+
|
129
|
+
## Exclude these keys from the `i18n-tasks eq-base' report:
|
130
|
+
# ignore_eq_base:
|
131
|
+
# all:
|
132
|
+
# - common.ok
|
133
|
+
# fr,es:
|
134
|
+
# - common.brand
|
135
|
+
|
136
|
+
## Exclude these keys from the `i18n-tasks check-consistent-interpolations` report:
|
137
|
+
# ignore_inconsistent_interpolations:
|
138
|
+
# - 'activerecord.attributes.*'
|
139
|
+
|
140
|
+
## Ignore these keys completely:
|
141
|
+
# ignore:
|
142
|
+
# - kaminari.*
|
143
|
+
|
144
|
+
## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
|
145
|
+
## e.g. in case of a relative key defined in a helper method.
|
146
|
+
## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
|
147
|
+
#
|
148
|
+
# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
149
|
+
# only: %w(*.html.haml *.html.slim),
|
150
|
+
# patterns: [['= title\b', '.page_title']] %>
|
151
|
+
#
|
152
|
+
# The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
|
153
|
+
#
|
154
|
+
# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
155
|
+
# patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
|
@@ -0,0 +1,240 @@
|
|
1
|
+
---
|
2
|
+
zh-CN:
|
3
|
+
home: 首页
|
4
|
+
edit: 编辑
|
5
|
+
new: 新建
|
6
|
+
back_to: 返回列表
|
7
|
+
show: 详情
|
8
|
+
destroy: 删除
|
9
|
+
remove_image: 移除图片
|
10
|
+
slots: 广告位
|
11
|
+
advertisements: 广告
|
12
|
+
publish: 发布
|
13
|
+
unpublish: 撤销发布
|
14
|
+
archive: 归档
|
15
|
+
unarchive: 撤销归档
|
16
|
+
github: Github
|
17
|
+
doc: 文档
|
18
|
+
activerecord:
|
19
|
+
attributes:
|
20
|
+
ad_space/slot:
|
21
|
+
name: 名称
|
22
|
+
uuid: UUID
|
23
|
+
remark: 备注
|
24
|
+
is_splash: 是否开屏位置?
|
25
|
+
demo: 示例图片
|
26
|
+
ad_space/advertisement:
|
27
|
+
name: 名称
|
28
|
+
uuid: UUID
|
29
|
+
published_at: 发布时间
|
30
|
+
started_at: 生效时间
|
31
|
+
ended_at: 失效时间
|
32
|
+
platform: 平台
|
33
|
+
archived_at: 归档时间
|
34
|
+
weight: 权重
|
35
|
+
remark: 备注
|
36
|
+
ad_type: 广告类型
|
37
|
+
visibility: 可见范围
|
38
|
+
scheme_url: 跳转地址
|
39
|
+
splash_countdown: 开屏倒计时
|
40
|
+
splash_ui_type: 开屏样式
|
41
|
+
dsp_type: DSP广告类型
|
42
|
+
target_version_codes: 目标版本
|
43
|
+
slot_id: 广告展示位置
|
44
|
+
enums:
|
45
|
+
ad_space/advertisement:
|
46
|
+
platform:
|
47
|
+
ios: 苹果
|
48
|
+
android: 安卓
|
49
|
+
dsp_type:
|
50
|
+
gdt: 广点通
|
51
|
+
jrtt: 穿山甲
|
52
|
+
google: 谷歌Adsense
|
53
|
+
splash_ui_type:
|
54
|
+
half: 半屏
|
55
|
+
full: 全屏
|
56
|
+
ad_type:
|
57
|
+
dsp: SDK广告
|
58
|
+
custom: 自定义广告
|
59
|
+
visibility:
|
60
|
+
all: 全部用户
|
61
|
+
regular_user: 非付费用户
|
62
|
+
premium_member: 付费用户
|
63
|
+
errors:
|
64
|
+
messages:
|
65
|
+
record_invalid: 验证失败:%{errors}
|
66
|
+
restrict_dependent_destroy:
|
67
|
+
has_one: 由于%{record}需要此记录,所以无法移除记录
|
68
|
+
has_many: 由于%{record}需要此记录,所以无法移除记录
|
69
|
+
date:
|
70
|
+
abbr_day_names:
|
71
|
+
- 周日
|
72
|
+
- 周一
|
73
|
+
- 周二
|
74
|
+
- 周三
|
75
|
+
- 周四
|
76
|
+
- 周五
|
77
|
+
- 周六
|
78
|
+
abbr_month_names:
|
79
|
+
-
|
80
|
+
- 1月
|
81
|
+
- 2月
|
82
|
+
- 3月
|
83
|
+
- 4月
|
84
|
+
- 5月
|
85
|
+
- 6月
|
86
|
+
- 7月
|
87
|
+
- 8月
|
88
|
+
- 9月
|
89
|
+
- 10月
|
90
|
+
- 11月
|
91
|
+
- 12月
|
92
|
+
day_names:
|
93
|
+
- 星期日
|
94
|
+
- 星期一
|
95
|
+
- 星期二
|
96
|
+
- 星期三
|
97
|
+
- 星期四
|
98
|
+
- 星期五
|
99
|
+
- 星期六
|
100
|
+
formats:
|
101
|
+
default: "%Y-%m-%d"
|
102
|
+
long: "%Y年%m月%d日"
|
103
|
+
short: "%m月%d日"
|
104
|
+
month_names:
|
105
|
+
-
|
106
|
+
- 一月
|
107
|
+
- 二月
|
108
|
+
- 三月
|
109
|
+
- 四月
|
110
|
+
- 五月
|
111
|
+
- 六月
|
112
|
+
- 七月
|
113
|
+
- 八月
|
114
|
+
- 九月
|
115
|
+
- 十月
|
116
|
+
- 十一月
|
117
|
+
- 十二月
|
118
|
+
order:
|
119
|
+
- :year
|
120
|
+
- :month
|
121
|
+
- :day
|
122
|
+
datetime:
|
123
|
+
distance_in_words:
|
124
|
+
about_x_hours: 大约%{count}小时
|
125
|
+
about_x_months: 大约%{count}个月
|
126
|
+
about_x_years: 大约%{count}年
|
127
|
+
almost_x_years: 接近%{count}年
|
128
|
+
half_a_minute: 半分钟
|
129
|
+
less_than_x_seconds: 不到%{count}秒
|
130
|
+
less_than_x_minutes: 不到%{count}分钟
|
131
|
+
over_x_years: "%{count}年多"
|
132
|
+
x_seconds: "%{count}秒"
|
133
|
+
x_minutes: "%{count}分钟"
|
134
|
+
x_days: "%{count}天"
|
135
|
+
x_months: "%{count}个月"
|
136
|
+
x_years: "%{count}年"
|
137
|
+
prompts:
|
138
|
+
second: 秒
|
139
|
+
minute: 分
|
140
|
+
hour: 时
|
141
|
+
day: 日
|
142
|
+
month: 月
|
143
|
+
year: 年
|
144
|
+
errors:
|
145
|
+
format: "%{attribute}%{message}"
|
146
|
+
messages:
|
147
|
+
accepted: 必须是可被接受的
|
148
|
+
blank: 不能为空字符
|
149
|
+
confirmation: 与%{attribute}不匹配
|
150
|
+
empty: 不能留空
|
151
|
+
equal_to: 必须等于%{count}
|
152
|
+
even: 必须为双数
|
153
|
+
exclusion: 是保留关键字
|
154
|
+
greater_than: 必须大于%{count}
|
155
|
+
greater_than_or_equal_to: 必须大于或等于%{count}
|
156
|
+
inclusion: 不包含于列表中
|
157
|
+
invalid: 是无效的
|
158
|
+
less_than: 必须小于%{count}
|
159
|
+
less_than_or_equal_to: 必须小于或等于%{count}
|
160
|
+
model_invalid: 验证失败:%{errors}
|
161
|
+
not_a_number: 不是数字
|
162
|
+
not_an_integer: 必须是整数
|
163
|
+
odd: 必须为单数
|
164
|
+
other_than: 长度非法(不可为%{count}个字符)
|
165
|
+
present: 必须是空白
|
166
|
+
required: 必须存在
|
167
|
+
taken: 已经被使用
|
168
|
+
too_long: 过长(最长为%{count}个字符)
|
169
|
+
too_short: 过短(最短为%{count}个字符)
|
170
|
+
wrong_length: 长度非法(必须为%{count}个字符)
|
171
|
+
template:
|
172
|
+
body: 如下字段出现错误:
|
173
|
+
header: 有%{count}个错误发生导致“%{model}”无法被保存。
|
174
|
+
helpers:
|
175
|
+
select:
|
176
|
+
prompt: 请选择
|
177
|
+
submit:
|
178
|
+
create: 新增%{model}
|
179
|
+
submit: 储存%{model}
|
180
|
+
update: 更新%{model}
|
181
|
+
number:
|
182
|
+
currency:
|
183
|
+
format:
|
184
|
+
delimiter: ","
|
185
|
+
format: "%u %n"
|
186
|
+
precision: 2
|
187
|
+
separator: "."
|
188
|
+
significant: false
|
189
|
+
strip_insignificant_zeros: false
|
190
|
+
unit: CN¥
|
191
|
+
format:
|
192
|
+
delimiter: ","
|
193
|
+
precision: 3
|
194
|
+
separator: "."
|
195
|
+
significant: false
|
196
|
+
strip_insignificant_zeros: false
|
197
|
+
human:
|
198
|
+
decimal_units:
|
199
|
+
format: "%n %u"
|
200
|
+
units:
|
201
|
+
billion: 十亿
|
202
|
+
million: 百万
|
203
|
+
quadrillion: 千兆
|
204
|
+
thousand: 千
|
205
|
+
trillion: 兆
|
206
|
+
unit: ''
|
207
|
+
format:
|
208
|
+
delimiter: ''
|
209
|
+
precision: 1
|
210
|
+
significant: false
|
211
|
+
strip_insignificant_zeros: false
|
212
|
+
storage_units:
|
213
|
+
format: "%n %u"
|
214
|
+
units:
|
215
|
+
byte: 字节
|
216
|
+
eb: EB
|
217
|
+
gb: GB
|
218
|
+
kb: KB
|
219
|
+
mb: MB
|
220
|
+
pb: PB
|
221
|
+
tb: TB
|
222
|
+
percentage:
|
223
|
+
format:
|
224
|
+
delimiter: ''
|
225
|
+
format: "%n%"
|
226
|
+
precision:
|
227
|
+
format:
|
228
|
+
delimiter: ''
|
229
|
+
support:
|
230
|
+
array:
|
231
|
+
last_word_connector: "、"
|
232
|
+
two_words_connector: 和
|
233
|
+
words_connector: "、"
|
234
|
+
time:
|
235
|
+
am: 上午
|
236
|
+
formats:
|
237
|
+
default: "%Y年%m月%d日 %A %H:%M:%S %Z"
|
238
|
+
long: "%Y年%m月%d日 %H:%M"
|
239
|
+
short: "%m月%d日 %H:%M"
|
240
|
+
pm: 下午
|
@@ -1,12 +1,17 @@
|
|
1
1
|
module AdSpace
|
2
2
|
class Configuration
|
3
|
+
DEFAULT_DASHBOARD_DEFAULT_LOCALE = "zh-CN"
|
4
|
+
|
3
5
|
attr_writer :app_name
|
4
6
|
attr_writer :root_path
|
5
7
|
attr_accessor :current_user
|
8
|
+
attr_accessor :dashboard_default_locale
|
9
|
+
|
6
10
|
|
7
11
|
def initialize
|
8
12
|
@root_path = "/ad_space"
|
9
13
|
@app_name = ::Rails.application.class.to_s.split("::").first.underscore.humanize(keep_id_suffix: true)
|
14
|
+
@dashboard_default_locale = DEFAULT_DASHBOARD_DEFAULT_LOCALE
|
10
15
|
end
|
11
16
|
|
12
17
|
def current_user_method(&block)
|
data/lib/ad_space/version.rb
CHANGED