translation_center 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/translation_center/translation_key.rb +11 -0
- data/app/views/translation_center/translations/_show.html.haml +1 -1
- data/lib/translation_center/locale/en.yml +2 -2
- data/lib/translation_center/translation_helpers.rb +7 -1
- data/lib/translation_center/version.rb +1 -1
- data/test/dummy/app/views/articles/index.html.haml +2 -0
- data/test/dummy/config/locales/en.yml +6 -19
- data/test/dummy/config/translation_center.yml +1 -1
- data/test/dummy/log/development.log +25197 -0
- data/test/dummy/tmp/cache/assets/C22/210/sprockets%2F517f3140647c785ea1002a8576742f84 +0 -0
- data/test/dummy/tmp/cache/assets/C2A/710/sprockets%2F84f5569342714e117c44ddc087920682 +0 -0
- data/test/dummy/tmp/cache/assets/C4C/C00/sprockets%2F4849fd265508c443749c502c075a04b1 +0 -0
- data/test/dummy/tmp/cache/assets/C52/430/sprockets%2F86292bde3f9d2873600774820f12b423 +0 -0
- data/test/dummy/tmp/cache/assets/C59/F40/sprockets%2F30604f8ab31b1d0250439c00204c9b51 +0 -0
- data/test/dummy/tmp/cache/assets/C8B/DF0/sprockets%2F7842cc61b9233655f4d298454174ca7e +0 -0
- data/test/dummy/tmp/cache/assets/C8E/2C0/sprockets%2Fec4e847481d089594eec27617025734a +0 -0
- data/test/dummy/tmp/cache/assets/CA0/B60/sprockets%2F642a16a344903c9da44b9b4304af1933 +0 -0
- data/test/dummy/tmp/cache/assets/CA1/AE0/sprockets%2Fc844ddad563c7b230520485601093e2d +0 -0
- data/test/dummy/tmp/cache/assets/CA9/810/sprockets%2F1c757abfc030043a7557826324f8b6b6 +0 -0
- data/test/dummy/tmp/cache/assets/CAB/590/sprockets%2F56b0adda4517bb2e57168c8438640742 +0 -0
- data/test/dummy/tmp/cache/assets/CB1/FF0/sprockets%2Fe681be210b3497903bc0f72a5955785a +0 -0
- data/test/dummy/tmp/cache/assets/CB8/160/sprockets%2F4c66a7ad546d4bd56393954a9531075d +0 -0
- data/test/dummy/tmp/cache/assets/CC6/7F0/sprockets%2F2e8c8e9dbe61408c47b778924833146f +0 -0
- data/test/dummy/tmp/cache/assets/CD9/E10/sprockets%2F94a2af68ee002632aa5747e00f233f78 +0 -0
- data/test/dummy/tmp/cache/assets/CDB/0B0/sprockets%2Fd44248d455dc32b5d0d0694193b9a3f3 +0 -0
- data/test/dummy/tmp/cache/assets/CE1/2F0/sprockets%2Fa11e6f312b6924c8b83f9664a54f21e5 +0 -0
- data/test/dummy/tmp/cache/assets/CE4/310/sprockets%2Fdf7adc5309a51f53f4f71b0389682533 +0 -0
- data/test/dummy/tmp/cache/assets/CEC/260/sprockets%2F5aac1d5511a4610034d1d00628abd48f +0 -0
- data/test/dummy/tmp/cache/assets/CFC/580/sprockets%2F0cc6da09d251ca33295323d3f084b39a +0 -0
- data/test/dummy/tmp/cache/assets/CFE/1B0/sprockets%2F857035385aad6d341c54bfbaa0e54350 +0 -0
- data/test/dummy/tmp/cache/assets/D02/670/sprockets%2F26f9d24cea6c30598c507cb5410c206a +0 -0
- data/test/dummy/tmp/cache/assets/D07/8E0/sprockets%2F676603acd5136b6df215240f26ccbf93 +0 -0
- data/test/dummy/tmp/cache/assets/D08/640/sprockets%2F06f23dadcaa8a04986519bd71b463355 +0 -0
- data/test/dummy/tmp/cache/assets/D0B/180/sprockets%2Ff4d81b3f6f4189421dca31e3010f7f66 +0 -0
- data/test/dummy/tmp/cache/assets/D0C/AF0/sprockets%2F6ecc8e66d29bd1ba485303a443858c11 +0 -0
- data/test/dummy/tmp/cache/assets/D0E/510/sprockets%2F5d3bea4ff0220229628ebbea69462856 +0 -0
- data/test/dummy/tmp/cache/assets/D0E/9A0/sprockets%2F4f8469bb2dd085499ca282b036fa40a5 +0 -0
- data/test/dummy/tmp/cache/assets/D11/250/sprockets%2Fa6248a89c55416d68c31cf36ab0fd329 +0 -0
- data/test/dummy/tmp/cache/assets/D15/920/sprockets%2F691bcdb58780274ee1cad67191428f1e +0 -0
- data/test/dummy/tmp/cache/assets/D1A/7F0/sprockets%2F45f05a2f9e999b2602b3de1d27769e0e +0 -0
- data/test/dummy/tmp/cache/assets/D1D/490/sprockets%2F0c642b4973985d31ff9e1d3f576e1dc4 +0 -0
- data/test/dummy/tmp/cache/assets/D2C/D60/sprockets%2Fc8e60f5dd6866d4bb516585b99b5e685 +0 -0
- data/test/dummy/tmp/cache/assets/D2C/F90/sprockets%2F765b59de8f82883b67ec821c27d4f45e +0 -0
- data/test/dummy/tmp/cache/assets/D2E/7A0/sprockets%2F7f6af8ca0e01927520d134bfa0b2d727 +0 -0
- data/test/dummy/tmp/cache/assets/D2F/FF0/sprockets%2F00d4ae0093a6d2ee8a2c5cf25283484b +0 -0
- data/test/dummy/tmp/cache/assets/D32/3E0/sprockets%2F512bcc52e900bc2787cb3bde0392908b +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D36/A70/sprockets%2Fe9e6c2471794226baecb461ad235b16b +0 -0
- data/test/dummy/tmp/cache/assets/D39/8A0/sprockets%2F3980e8ae05155e0db07629fc6b4f1bd1 +0 -0
- data/test/dummy/tmp/cache/assets/D3D/A50/sprockets%2F117dc38b0a178661ba6d8ab89dcd3654 +0 -0
- data/test/dummy/tmp/cache/assets/D40/C40/sprockets%2F7805bef3fba944d45a5ea7a39d155811 +0 -0
- data/test/dummy/tmp/cache/assets/D42/0C0/sprockets%2Ff87838d2038e61d22b75d94a5b1fbc5a +0 -0
- data/test/dummy/tmp/cache/assets/D45/1D0/sprockets%2F7bd7915ecb570577f128a25ce1efd606 +0 -0
- data/test/dummy/tmp/cache/assets/D4D/070/sprockets%2Fdf13d074ff891a2a21d81f85f5986ac9 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/9C0/sprockets%2F3d02e73e7707b6ca48dba558f07879ee +0 -0
- data/test/dummy/tmp/cache/assets/D4F/680/sprockets%2F1ec92a2577e82f760e1a8ef8b3619f8b +0 -0
- data/test/dummy/tmp/cache/assets/D4F/CF0/sprockets%2F6eb5003021c08aa7a0fc0251d9c48abf +0 -0
- data/test/dummy/tmp/cache/assets/D5A/C20/sprockets%2Ff38caf7fc2f5920b17e8687b76189e4e +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D64/A40/sprockets%2F115bd6dafb378b6a3d6b06fb8554d015 +0 -0
- data/test/dummy/tmp/cache/assets/D64/F20/sprockets%2Fc4f6a5b423127cf5d0addcc3228c8807 +0 -0
- data/test/dummy/tmp/cache/assets/D66/B40/sprockets%2Fabce0c270b76ab65990ac6257448db5a +0 -0
- data/test/dummy/tmp/cache/assets/D67/830/sprockets%2F4afca5f6623b7d20f679dfc3b30560a4 +0 -0
- data/test/dummy/tmp/cache/assets/D68/C60/sprockets%2F31540eb5a9cab152c979c8029aad8c4d +0 -0
- data/test/dummy/tmp/cache/assets/D6E/A00/sprockets%2F0fa3735908bd70b81ecdea18839c7a2d +0 -0
- data/test/dummy/tmp/cache/assets/D78/D40/sprockets%2F07dc41befc8c7f688c7a3616190dd4a9 +0 -0
- data/test/dummy/tmp/cache/assets/D7E/960/sprockets%2F3f80d2e95fabc7b794bd0f188c0c9766 +0 -0
- data/test/dummy/tmp/cache/assets/D80/A90/sprockets%2Fd10ca78b0371fbad00011e75ef71edc0 +0 -0
- data/test/dummy/tmp/cache/assets/D80/C50/sprockets%2F4dd8b889e6eff505a7cd9a12ca182695 +0 -0
- data/test/dummy/tmp/cache/assets/D8B/360/sprockets%2F05112d46d08ba7edc57d16d30aece0c7 +0 -0
- data/test/dummy/tmp/cache/assets/D91/AE0/sprockets%2Fa55d2132eda91c553ef2bee505d84eb0 +0 -0
- data/test/dummy/tmp/cache/assets/D97/D90/sprockets%2F7bb73dc9ef435a3408b54c3b2e5dcb16 +0 -0
- data/test/dummy/tmp/cache/assets/D98/600/sprockets%2F0df44aa17b85e2b8bdb31f49c664bc90 +0 -0
- data/test/dummy/tmp/cache/assets/D9A/AF0/sprockets%2Fe5fc66f22b717fc0eb6c460ea1806f3c +0 -0
- data/test/dummy/tmp/cache/assets/D9C/E20/sprockets%2Fb865317c6a5e8d0a7287d5bbe5aeab34 +0 -0
- data/test/dummy/tmp/cache/assets/D9E/B80/sprockets%2F97e683d4fae31c45cfb5db8ad7151c31 +0 -0
- data/test/dummy/tmp/cache/assets/D9F/6C0/sprockets%2F78d1038a1d2d17f8ab97d4cc0eaf2f49 +0 -0
- data/test/dummy/tmp/cache/assets/DA5/550/sprockets%2F58a4dc797a54fcd90b13fd6ed323d4d6 +0 -0
- data/test/dummy/tmp/cache/assets/DAA/730/sprockets%2F2c3ea744dd981c4bd5e7f92189db6bd4 +0 -0
- data/test/dummy/tmp/cache/assets/DAC/400/sprockets%2Feaf0cd409799f44893175de3ecb1ebb8 +0 -0
- data/test/dummy/tmp/cache/assets/DAC/AB0/sprockets%2F48b51d8298dfc3ef0bfb56cd9475e52a +0 -0
- data/test/dummy/tmp/cache/assets/DC6/7B0/sprockets%2F7b70b71efa8ea052e4acfe7b10a74c95 +0 -0
- data/test/dummy/tmp/cache/assets/DD6/D30/sprockets%2F1de67a4ee9e74a3e4a2b45ece3a992e6 +0 -0
- data/test/dummy/tmp/cache/assets/DEA/130/sprockets%2F7fdb34a9eecf9cca01e2a1014a3b8e14 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E11/E90/sprockets%2F7759ba2bb5f7b84be4fec9aef9c81c37 +0 -0
- data/test/dummy/tmp/cache/assets/EB6/660/sprockets%2Fcadf13dcbaa4abcf0f8e05a9a59bee97 +0 -0
- data/test/dummy/tmp/pids/server.pid +1 -1
- metadata +80 -2
@@ -143,6 +143,17 @@ module TranslationCenter
|
|
143
143
|
stats
|
144
144
|
end
|
145
145
|
|
146
|
+
def children_translations(locale)
|
147
|
+
TranslationKey.where('name LIKE ?', "#{self.name}%").inject({}) do |translations, child|
|
148
|
+
translations[child.name.to_sym] = child.accepted_translation_in(locale).try(:value)
|
149
|
+
translations
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def has_children?
|
154
|
+
TranslationKey.where('name LIKE ?', "#{self.name}%").count > 1
|
155
|
+
end
|
156
|
+
|
146
157
|
# adds a translation key with its translation to a translation yaml hash
|
147
158
|
# send the hash and the language as parameters
|
148
159
|
def add_to_hash(all_translations, lang)
|
@@ -23,7 +23,7 @@
|
|
23
23
|
.votes_count.badge.badge-success.pull-right
|
24
24
|
%span.count{ 'data-translation-id' => translation.id }
|
25
25
|
= translation.votes.count
|
26
|
-
= t('.
|
26
|
+
= t('.votings')
|
27
27
|
%a.pull-right{href: '#'}
|
28
28
|
- voted = current_user.voted_on?(translation)
|
29
29
|
%span.badge.pull-left.translations_vote{ class: "#{voted ? 'badge-success' : ''}", 'data-translation-id' => translation.id, voted: voted.to_s}
|
@@ -69,7 +69,13 @@ module TranslationCenter
|
|
69
69
|
val = translation_key.accepted_translation_in(locale).try(:value) || options[:default]
|
70
70
|
# replace variables in a translation with passed values
|
71
71
|
options.each_pair{ |key, value| val.gsub!("%{#{key.to_s}}", value.to_s) } if val.is_a?(String)
|
72
|
-
|
72
|
+
|
73
|
+
if val.blank? && !translation_key.has_children?
|
74
|
+
throw(:exception, I18n::MissingTranslation.new(locale, complete_key, options))
|
75
|
+
elsif translation_key.has_children?
|
76
|
+
# TODO should use ancestors for keys
|
77
|
+
return translation_key.children_translations(locale)
|
78
|
+
end
|
73
79
|
wrap_span(val, translation_key)
|
74
80
|
else
|
75
81
|
# just return the normal I18n translation
|
@@ -1,12 +1,10 @@
|
|
1
1
|
---
|
2
2
|
en:
|
3
3
|
activerecord:
|
4
|
-
attributes: Attributes
|
5
4
|
errors:
|
6
5
|
messages:
|
7
6
|
record_invalid: "Validation failed: %{errors}"
|
8
7
|
taken: "has already been taken"
|
9
|
-
models: Models
|
10
8
|
date:
|
11
9
|
abbr_day_names:
|
12
10
|
- Sun
|
@@ -180,6 +178,10 @@ en:
|
|
180
178
|
too_short: "is too short (minimum is %{count} characters)"
|
181
179
|
wrong_length: "is the wrong length (should be %{count} characters)"
|
182
180
|
helpers:
|
181
|
+
button:
|
182
|
+
create: "Create %{model}"
|
183
|
+
submit: "Save %{model}"
|
184
|
+
update: "Update %{model}"
|
183
185
|
select:
|
184
186
|
prompt: "Please select"
|
185
187
|
submit:
|
@@ -315,25 +317,10 @@ en:
|
|
315
317
|
index:
|
316
318
|
date: Date
|
317
319
|
sort_by: "Sort by"
|
318
|
-
|
320
|
+
votings: Votes
|
319
321
|
show:
|
320
322
|
by: by
|
321
323
|
on_date: "on"
|
322
324
|
vote: Vote
|
323
|
-
|
325
|
+
votings: Votes
|
324
326
|
you: You
|
325
|
-
will_paginate:
|
326
|
-
next_label: "Next →"
|
327
|
-
page_entries_info:
|
328
|
-
multi_page: "Displaying %{model} %{from} - %{to} of %{count} in total"
|
329
|
-
multi_page_html: "Displaying %{model} <b>%{from} - %{to}</b> of <b>%{count}</b> in total"
|
330
|
-
single_page:
|
331
|
-
one: "Displaying 1 %{model}"
|
332
|
-
other: "Displaying all %{count} %{model}"
|
333
|
-
zero: "No %{model} found"
|
334
|
-
single_page_html:
|
335
|
-
one: "Displaying <b>1</b> %{model}"
|
336
|
-
other: "Displaying <b>all %{count}</b> %{model}"
|
337
|
-
zero: "No %{model} found"
|
338
|
-
page_gap: "…"
|
339
|
-
previous_label: "← Previous"
|
@@ -30,7 +30,7 @@ development:
|
|
30
30
|
# "missing" to inspect only untranslated keys
|
31
31
|
# "all" to enable inspector for translated and untranslated keys
|
32
32
|
# "off" to turn off keys inspector
|
33
|
-
inspector: '
|
33
|
+
inspector: 'missing' # default missing
|
34
34
|
|
35
35
|
# I18n.translate source
|
36
36
|
i18n_source: 'db' # can be db or yaml; default is yaml
|