awesome_translations 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fea063f52c4b5c59c136414a116a24b4735db9f
4
- data.tar.gz: 7464db6a00df91622aec0160dc371e5bd1c99f6d
3
+ metadata.gz: 3e0100ab729267c0c2a4b96553d791d80f19a706
4
+ data.tar.gz: c50097d0d61e87c7963148b8667caa2f90435e7b
5
5
  SHA512:
6
- metadata.gz: a438f09fd630e7ca156f4a9311df7479f53f5d9d3af84b90cd4b95b8bd2b4df4c7556c8a366b8d83d803f1959a29831e64753264e7d1b29e805010e443e49112
7
- data.tar.gz: 3d0d0a750867502382977adaf99950ee5d5524ab9f9037604dc617e33ddc477dbcf71bd0c16ee3605f5d36e54d71e0c7316a66105b97bf8cd4ac05e6701bb625
6
+ metadata.gz: 1120b1e5056145e05dd733ef07384c2bbc9cb1b121fb59521c134c2128917cfb3800b692c855adbfe34165ce15b3c0d5f06ae3e7b0ef75930d4c1a0f15cf6f0c
7
+ data.tar.gz: a92f18f5e0a4af86478bfb5d642df4e01270dd20f23bc191f12e60e0b6da712a8856339df8e904c83442604841820f4f591cdc074aa7edf6b78b2d9c44b86500
data/README.md CHANGED
@@ -28,11 +28,38 @@ If you want to do translations from your models or controllers, you will need to
28
28
  AwesomeTranslations.load_object_extensions
29
29
  ```
30
30
 
31
+ If you don't like monkey patching the Object-class, you can also load it like this by creating 'config/initializers/awesome_translations' and insert something like this to allow t-method-calls from inside models:
32
+ ```ruby
33
+ ActiveRecord::Base.__send__(:include, AwesomeTranslations::TranslateFunctionality)
34
+ ```
35
+
31
36
  You will also need to modify the line in your Gemfile a bit:
32
37
  ```ruby
33
38
  gem 'awesome_translations'
34
39
  ```
35
40
 
41
+ ## Helper translations
42
+
43
+ The t-method translates like from inside a view in Rails. To get around this, you can call 'helper_t' instead. Start by including that method in your helpers by adding this to ApplicationHelper:
44
+ ```ruby
45
+ module ApplicationHelper
46
+ include AwesomeTranslations::ApplicationHelper
47
+ end
48
+ ```
49
+
50
+ This is an example of how it works and what the difference is:
51
+ ```ruby
52
+ module ApplicationHelper
53
+ include AwesomeTranslations::ApplicationHelper
54
+
55
+ # Sample method with translation
56
+ def hello_world
57
+ t('.hello_world') #=> translates with key '#{controller_name}.#{action_name}.hello_world'
58
+ return helper_t('.hello_world') #=> translates with key 'helpers.application_helper.hello_world'
59
+ end
60
+ end
61
+ ```
62
+
36
63
  ## Translating your application
37
64
 
38
65
  Start a Rails server for your project and go to the namespace called something like "http://localhost:3000/awesome_translations". Start translating your app through the webinterface.
@@ -1,4 +1,5 @@
1
- module AwesomeTranslations
2
- module ApplicationHelper
1
+ module AwesomeTranslations::ApplicationHelper
2
+ def helper_t(key, args = {})
3
+ AwesomeTranslations::GlobalTranslator.translate(key, caller_number: 1, translation_args: [args])
3
4
  end
4
5
  end
@@ -52,7 +52,7 @@ class AwesomeTranslations::Group
52
52
  end
53
53
 
54
54
  def to_s
55
- "<AwesomeTranslations::Group id=\"#{@id}\" name=\"#{@name}\">"
55
+ "<AwesomeTranslations::Group id=\"#{@id}\" name=\"#{name}\">"
56
56
  end
57
57
 
58
58
  def inspect
@@ -1,5 +1,5 @@
1
1
  class AwesomeTranslations::ErbInspector::FileInspector
2
- METHOD_NAMES = ["t"]
2
+ METHOD_NAMES = ['t', 'helper_t']
3
3
  VALID_BEGINNING = '(^|\s+|\(|\{|\[|<%=\s*)'
4
4
 
5
5
  attr_reader :root_path, :file_path
@@ -7,6 +7,7 @@ class AwesomeTranslations::ErbInspector::FileInspector
7
7
  def initialize(args)
8
8
  @args = args
9
9
  @root_path, @file_path = args[:root_path], args[:file_path]
10
+ @method_names ||= ['t']
10
11
  end
11
12
 
12
13
  def translations
@@ -28,7 +28,7 @@ class AwesomeTranslations::ErbInspector::TranslationInspector
28
28
  private
29
29
 
30
30
  def generate_full_key
31
- if @method == "t" && @key.start_with?(".")
31
+ if (@method == 't' || @method == 'helper_t') && @key.start_with?('.')
32
32
  @full_key = "#{File.dirname(@file_path)}"
33
33
 
34
34
  if @full_key.starts_with?("app/mailers")
@@ -50,7 +50,7 @@ private
50
50
  @full_key << ".#{@last_method}" if is_mailer && @last_method
51
51
  @full_key << "."
52
52
  @full_key << @key.gsub(/\A\./, "")
53
- elsif @method == "t"
53
+ elsif @method == 't' || @method == 'helper_t'
54
54
  @full_key = @key
55
55
  else
56
56
  raise "Unknown method-name: '#{@method}'."
@@ -31,7 +31,7 @@ private
31
31
 
32
32
  def erb_inspector
33
33
  @erb_inspector ||= AwesomeTranslations::ErbInspector.new(
34
- exts: [".rb"]
34
+ exts: ['.rb']
35
35
  )
36
36
  end
37
37
  end
@@ -1,3 +1,3 @@
1
1
  module AwesomeTranslations
2
- VERSION = '0.0.17'
2
+ VERSION = '0.0.18'
3
3
  end
@@ -1,2 +1,7 @@
1
1
  module ApplicationHelper
2
+ include AwesomeTranslations::ApplicationHelper
3
+
4
+ def hello_world
5
+ helper_t('.hello_world')
6
+ end
2
7
  end
@@ -19,4 +19,8 @@
19
19
  = t(".hello_world")
20
20
  = t(".hello_world")
21
21
 
22
+ .helper_hello_world
23
+ = "Hello world from helper"
24
+ = hello_world
25
+
22
26
  = yield
@@ -20193,3 +20193,325 @@ Started GET "/assets/awesome_translations/groups.self.css?body=1" for 127.0.0.1
20193
20193
 
20194
20194
 
20195
20195
  Started GET "/assets/awesome_translations/application.self.js?body=1" for 127.0.0.1 at 2015-06-13 15:11:20 +0200
20196
+
20197
+
20198
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:55:42 +0200
20199
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
20200
+ Processing by UsersController#index as HTML
20201
+ User Load (0.1ms) SELECT "users".* FROM "users"
20202
+ Rendered users/index.html.haml within layouts/application (8.4ms)
20203
+ Completed 500 Internal Server Error in 162ms
20204
+
20205
+ ActionView::Template::Error (undefined method `helper_t' for #<#<Class:0x000000037378c0>:0x000000037346e8>):
20206
+ 21:
20207
+ 22: .helper_hello_world
20208
+ 23: = "Hello world from helper"
20209
+ 24: = hello_world
20210
+ 25:
20211
+ 26: = yield
20212
+ app/helpers/application_helper.rb:3:in `hello_world'
20213
+ app/views/layouts/application.html.haml:24:in `_app_views_layouts_application_html_haml__3085525727710491263_28518560'
20214
+
20215
+
20216
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.9ms)
20217
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.6ms)
20218
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (7.0ms)
20219
+
20220
+
20221
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:56:04 +0200
20222
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
20223
+ Processing by UsersController#index as HTML
20224
+ User Load (0.1ms) SELECT "users".* FROM "users"
20225
+ Rendered users/index.html.haml within layouts/application (8.1ms)
20226
+ Completed 500 Internal Server Error in 159ms
20227
+
20228
+ ActionView::Template::Error (undefined method `helper_t' for #<#<Class:0x0000000447e560>:0x0000000447c7d8>):
20229
+ 21:
20230
+ 22: .helper_hello_world
20231
+ 23: = "Hello world from helper"
20232
+ 24: = hello_world
20233
+ 25:
20234
+ 26: = yield
20235
+ app/helpers/application_helper.rb:3:in `hello_world'
20236
+ app/views/layouts/application.html.haml:24:in `_app_views_layouts_application_html_haml___1426375834028172687_35475440'
20237
+
20238
+
20239
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.7ms)
20240
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.6ms)
20241
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (6.2ms)
20242
+
20243
+
20244
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:56:22 +0200
20245
+ Processing by UsersController#index as HTML
20246
+ User Load (0.2ms) SELECT "users".* FROM "users"
20247
+ Rendered users/index.html.haml within layouts/application (1.3ms)
20248
+ Completed 200 OK in 11ms (Views: 8.8ms | ActiveRecord: 0.2ms)
20249
+
20250
+
20251
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:56:22 +0200
20252
+
20253
+
20254
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:22 +0200
20255
+
20256
+
20257
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:22 +0200
20258
+
20259
+
20260
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:22 +0200
20261
+
20262
+
20263
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:56:30 +0200
20264
+ Processing by UsersController#index as HTML
20265
+ User Load (0.1ms) SELECT "users".* FROM "users"
20266
+ Rendered users/index.html.haml within layouts/application (1.3ms)
20267
+ Completed 200 OK in 9ms (Views: 8.4ms | ActiveRecord: 0.1ms)
20268
+
20269
+
20270
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:56:30 +0200
20271
+
20272
+
20273
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:30 +0200
20274
+
20275
+
20276
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:30 +0200
20277
+
20278
+
20279
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:30 +0200
20280
+
20281
+
20282
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:56:31 +0200
20283
+ Processing by UsersController#index as HTML
20284
+ User Load (0.2ms) SELECT "users".* FROM "users"
20285
+ Rendered users/index.html.haml within layouts/application (1.9ms)
20286
+ Completed 200 OK in 14ms (Views: 12.9ms | ActiveRecord: 0.2ms)
20287
+
20288
+
20289
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:56:31 +0200
20290
+
20291
+
20292
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:31 +0200
20293
+
20294
+
20295
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:31 +0200
20296
+
20297
+
20298
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:31 +0200
20299
+
20300
+
20301
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:56:39 +0200
20302
+ Processing by UsersController#index as HTML
20303
+ User Load (0.2ms) SELECT "users".* FROM "users"
20304
+ Rendered users/index.html.haml within layouts/application (1.4ms)
20305
+ Completed 200 OK in 12ms (Views: 9.3ms | ActiveRecord: 0.2ms)
20306
+
20307
+
20308
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:56:40 +0200
20309
+
20310
+
20311
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:40 +0200
20312
+
20313
+
20314
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:40 +0200
20315
+
20316
+
20317
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:40 +0200
20318
+
20319
+
20320
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:56:45 +0200
20321
+ Processing by UsersController#index as HTML
20322
+ User Load (0.2ms) SELECT "users".* FROM "users"
20323
+ Rendered users/index.html.haml within layouts/application (1.4ms)
20324
+ Completed 200 OK in 11ms (Views: 8.2ms | ActiveRecord: 0.2ms)
20325
+
20326
+
20327
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:56:45 +0200
20328
+
20329
+
20330
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:45 +0200
20331
+
20332
+
20333
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:45 +0200
20334
+
20335
+
20336
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:56:45 +0200
20337
+
20338
+
20339
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:57:10 +0200
20340
+ Processing by UsersController#index as HTML
20341
+ User Load (0.2ms) SELECT "users".* FROM "users"
20342
+ Rendered users/index.html.haml within layouts/application (1.4ms)
20343
+ Completed 500 Internal Server Error in 17ms
20344
+
20345
+ ActionView::Template::Error (undefined method `helper_t' for #<#<Class:0x007f438009f018>:0x007f438009e410>):
20346
+ 21:
20347
+ 22: .helper_hello_world
20348
+ 23: = "Hello world from helper"
20349
+ 24: = hello_world
20350
+ 25:
20351
+ 26: = yield
20352
+ app/helpers/application_helper.rb:5:in `hello_world'
20353
+ app/views/layouts/application.html.haml:24:in `_app_views_layouts_application_html_haml___1426375834028172687_35475440'
20354
+
20355
+
20356
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.8ms)
20357
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.6ms)
20358
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (6.1ms)
20359
+
20360
+
20361
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:57:17 +0200
20362
+ Processing by UsersController#index as HTML
20363
+ User Load (0.2ms) SELECT "users".* FROM "users"
20364
+ Rendered users/index.html.haml within layouts/application (1.4ms)
20365
+ Completed 500 Internal Server Error in 16ms
20366
+
20367
+ ActionView::Template::Error (undefined method `helper_t' for #<#<Class:0x007f4391bc8898>:0x007f4391c2fc28>):
20368
+ 21:
20369
+ 22: .helper_hello_world
20370
+ 23: = "Hello world from helper"
20371
+ 24: = hello_world
20372
+ 25:
20373
+ 26: = yield
20374
+ app/helpers/application_helper.rb:5:in `hello_world'
20375
+ app/views/layouts/application.html.haml:24:in `_app_views_layouts_application_html_haml___1426375834028172687_35475440'
20376
+
20377
+
20378
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.8ms)
20379
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.8ms)
20380
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (6.7ms)
20381
+
20382
+
20383
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:58:08 +0200
20384
+ Processing by UsersController#index as HTML
20385
+ User Load (0.2ms) SELECT "users".* FROM "users"
20386
+ Rendered users/index.html.haml within layouts/application (1.3ms)
20387
+ Completed 200 OK in 10ms (Views: 7.7ms | ActiveRecord: 0.2ms)
20388
+
20389
+
20390
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:58:08 +0200
20391
+
20392
+
20393
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:58:08 +0200
20394
+
20395
+
20396
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:58:08 +0200
20397
+
20398
+
20399
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:58:08 +0200
20400
+
20401
+
20402
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:58:22 +0200
20403
+ Processing by UsersController#index as HTML
20404
+ User Load (0.2ms) SELECT "users".* FROM "users"
20405
+ Rendered users/index.html.haml within layouts/application (1.4ms)
20406
+ Completed 500 Internal Server Error in 17ms
20407
+
20408
+ ActionView::Template::Error (undefined local variable or method `__caller__' for #<#<Class:0x007f438048dcb0>:0x007f438048cf68>):
20409
+ 21:
20410
+ 22: .helper_hello_world
20411
+ 23: = "Hello world from helper"
20412
+ 24: = hello_world
20413
+ 25:
20414
+ 26: = yield
20415
+ app/helpers/application_helper.rb:5:in `hello_world'
20416
+ app/views/layouts/application.html.haml:24:in `_app_views_layouts_application_html_haml___1426375834028172687_35475440'
20417
+
20418
+
20419
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.7ms)
20420
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.6ms)
20421
+ Rendered /home/kaspernj/.rvm/gems/ruby-2.1-head/gems/actionpack-4.0.10/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (6.7ms)
20422
+
20423
+
20424
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:58:30 +0200
20425
+ Processing by UsersController#index as HTML
20426
+ User Load (0.2ms) SELECT "users".* FROM "users"
20427
+ Rendered users/index.html.haml within layouts/application (1.3ms)
20428
+ Completed 200 OK in 12ms (Views: 9.3ms | ActiveRecord: 0.2ms)
20429
+
20430
+
20431
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:58:30 +0200
20432
+
20433
+
20434
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:58:30 +0200
20435
+
20436
+
20437
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:58:30 +0200
20438
+
20439
+
20440
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:58:30 +0200
20441
+
20442
+
20443
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:58:49 +0200
20444
+ Processing by UsersController#index as HTML
20445
+ User Load (0.2ms) SELECT "users".* FROM "users"
20446
+ Rendered users/index.html.haml within layouts/application (1.4ms)
20447
+ Completed 200 OK in 11ms (Views: 8.4ms | ActiveRecord: 0.2ms)
20448
+
20449
+
20450
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:58:49 +0200
20451
+
20452
+
20453
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:58:49 +0200
20454
+
20455
+
20456
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:58:49 +0200
20457
+
20458
+
20459
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:58:49 +0200
20460
+
20461
+
20462
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:59:02 +0200
20463
+ Processing by UsersController#index as HTML
20464
+ User Load (0.2ms) SELECT "users".* FROM "users"
20465
+ Rendered users/index.html.haml within layouts/application (1.5ms)
20466
+ Completed 200 OK in 11ms (Views: 8.5ms | ActiveRecord: 0.2ms)
20467
+
20468
+
20469
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:59:02 +0200
20470
+
20471
+
20472
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:59:02 +0200
20473
+
20474
+
20475
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:59:02 +0200
20476
+
20477
+
20478
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:59:02 +0200
20479
+
20480
+
20481
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:59:03 +0200
20482
+ Processing by UsersController#index as HTML
20483
+ User Load (0.2ms) SELECT "users".* FROM "users"
20484
+ Rendered users/index.html.haml within layouts/application (2.1ms)
20485
+ Completed 200 OK in 14ms (Views: 13.0ms | ActiveRecord: 0.2ms)
20486
+
20487
+
20488
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:59:03 +0200
20489
+
20490
+
20491
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:59:03 +0200
20492
+
20493
+
20494
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:59:03 +0200
20495
+
20496
+
20497
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:59:03 +0200
20498
+
20499
+
20500
+ Started GET "/" for 127.0.0.1 at 2015-06-17 09:59:07 +0200
20501
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
20502
+ Processing by UsersController#index as HTML
20503
+ User Load (0.1ms) SELECT "users".* FROM "users"
20504
+ Rendered users/index.html.haml within layouts/application (8.1ms)
20505
+ Completed 200 OK in 149ms (Views: 140.0ms | ActiveRecord: 0.1ms)
20506
+
20507
+
20508
+ Started GET "/assets/application.self.css?body=1" for 127.0.0.1 at 2015-06-17 09:59:08 +0200
20509
+
20510
+
20511
+ Started GET "/assets/jquery.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:59:08 +0200
20512
+
20513
+
20514
+ Started GET "/assets/jquery_ujs.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:59:08 +0200
20515
+
20516
+
20517
+ Started GET "/assets/application.self.js?body=1" for 127.0.0.1 at 2015-06-17 09:59:08 +0200
@@ -15656,3 +15656,187 @@ Completed 302 Found in 7ms (ActiveRecord: 0.0ms)
15656
15656
   (0.0ms) rollback transaction
15657
15657
   (0.0ms) begin transaction
15658
15658
   (0.0ms) rollback transaction
15659
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15660
+  (0.1ms) begin transaction
15661
+  (0.1ms) rollback transaction
15662
+  (0.0ms) begin transaction
15663
+  (0.0ms) rollback transaction
15664
+  (0.0ms) begin transaction
15665
+  (0.0ms) rollback transaction
15666
+  (0.0ms) begin transaction
15667
+  (0.0ms) rollback transaction
15668
+  (0.0ms) begin transaction
15669
+  (0.0ms) rollback transaction
15670
+  (0.0ms) begin transaction
15671
+  (0.0ms) rollback transaction
15672
+  (0.0ms) begin transaction
15673
+  (0.0ms) rollback transaction
15674
+  (0.0ms) begin transaction
15675
+  (0.0ms) rollback transaction
15676
+  (0.0ms) begin transaction
15677
+  (0.1ms) rollback transaction
15678
+  (0.0ms) begin transaction
15679
+  (0.0ms) rollback transaction
15680
+  (0.0ms) begin transaction
15681
+  (0.0ms) rollback transaction
15682
+  (0.0ms) begin transaction
15683
+  (0.0ms) rollback transaction
15684
+  (0.0ms) begin transaction
15685
+  (0.0ms) rollback transaction
15686
+  (0.0ms) begin transaction
15687
+  (0.0ms) rollback transaction
15688
+  (0.0ms) begin transaction
15689
+  (0.0ms) rollback transaction
15690
+  (0.0ms) begin transaction
15691
+  (0.0ms) rollback transaction
15692
+  (0.0ms) begin transaction
15693
+  (0.0ms) rollback transaction
15694
+  (0.0ms) begin transaction
15695
+  (0.0ms) rollback transaction
15696
+  (0.1ms) begin transaction
15697
+  (0.0ms) rollback transaction
15698
+  (0.0ms) begin transaction
15699
+  (0.0ms) rollback transaction
15700
+  (0.0ms) begin transaction
15701
+  (0.0ms) rollback transaction
15702
+  (0.0ms) begin transaction
15703
+  (0.0ms) rollback transaction
15704
+  (0.0ms) begin transaction
15705
+  (0.0ms) rollback transaction
15706
+  (0.0ms) begin transaction
15707
+  (0.0ms) rollback transaction
15708
+  (0.0ms) begin transaction
15709
+  (0.0ms) SAVEPOINT active_record_1
15710
+ User Exists (0.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'pnichols@thoughtworks.net' LIMIT 1
15711
+ SQL (1.8ms) INSERT INTO "users" ("age", "email", "password") VALUES (?, ?, ?) [["age", 3], ["email", "pnichols@thoughtworks.net"], ["password", "nam congue"]]
15712
+  (0.0ms) RELEASE SAVEPOINT active_record_1
15713
+ Processing by UsersController#index as HTML
15714
+ User Load (0.1ms) SELECT "users".* FROM "users"
15715
+ Rendered users/index.html.haml within layouts/application (11.0ms)
15716
+ Completed 200 OK in 124ms (Views: 123.1ms | ActiveRecord: 0.1ms)
15717
+  (0.1ms) rollback transaction
15718
+  (0.0ms) begin transaction
15719
+  (0.0ms) rollback transaction
15720
+  (0.0ms) begin transaction
15721
+  (0.0ms) rollback transaction
15722
+  (0.0ms) begin transaction
15723
+  (0.0ms) rollback transaction
15724
+  (0.0ms) begin transaction
15725
+  (0.0ms) rollback transaction
15726
+  (0.0ms) begin transaction
15727
+  (0.0ms) rollback transaction
15728
+  (0.0ms) begin transaction
15729
+  (0.0ms) rollback transaction
15730
+  (0.0ms) begin transaction
15731
+  (0.0ms) rollback transaction
15732
+  (0.0ms) begin transaction
15733
+  (0.0ms) rollback transaction
15734
+  (0.0ms) begin transaction
15735
+  (0.0ms) rollback transaction
15736
+  (0.0ms) begin transaction
15737
+  (0.0ms) rollback transaction
15738
+  (0.0ms) begin transaction
15739
+  (0.0ms) rollback transaction
15740
+  (0.0ms) begin transaction
15741
+  (0.1ms) rollback transaction
15742
+  (0.0ms) begin transaction
15743
+  (0.1ms) rollback transaction
15744
+  (0.0ms) begin transaction
15745
+  (0.1ms) rollback transaction
15746
+  (0.0ms) begin transaction
15747
+  (0.0ms) rollback transaction
15748
+  (0.0ms) begin transaction
15749
+  (0.0ms) rollback transaction
15750
+  (0.0ms) begin transaction
15751
+  (0.0ms) rollback transaction
15752
+  (0.0ms) begin transaction
15753
+ Processing by AwesomeTranslations::GroupsController#update as HTML
15754
+ Parameters: {"handler_id"=>"model_handler", "id"=>"Role", "t"=>{"activerecord.attributes.role.role"=>{"da"=>"Rolle", "de"=>"Die type", "en"=>"Role"}}}
15755
+ Redirected to http://test.host/handlers/model_handler/groups/Role
15756
+ Completed 302 Found in 4ms (ActiveRecord: 0.0ms)
15757
+  (0.0ms) rollback transaction
15758
+  (0.0ms) begin transaction
15759
+ Processing by AwesomeTranslations::GroupsController#update as HTML
15760
+ Parameters: {"handler_id"=>"rails_handler", "id"=>"date_time", "t"=>{"date.day_names"=>{"1"=>{"da"=>"Mandag"}, "4"=>{"da"=>"Torsdag"}}}}
15761
+ Redirected to http://test.host/handlers/rails_handler/groups/date_time
15762
+ Completed 302 Found in 41ms (ActiveRecord: 0.0ms)
15763
+  (0.1ms) rollback transaction
15764
+  (0.0ms) begin transaction
15765
+ Processing by AwesomeTranslations::GroupsController#update as HTML
15766
+ Parameters: {"handler_id"=>"model_handler", "id"=>"User", "t"=>{"activerecord.attributes.user.password"=>"[FILTERED]"}}
15767
+ Redirected to http://test.host/handlers/model_handler/groups/User
15768
+ Completed 302 Found in 7ms (ActiveRecord: 0.0ms)
15769
+  (0.0ms) rollback transaction
15770
+  (0.0ms) begin transaction
15771
+  (0.0ms) rollback transaction
15772
+  (0.0ms) begin transaction
15773
+ Processing by AwesomeTranslations::HandlersController#index as HTML
15774
+ Completed 200 OK in 100ms (Views: 100.0ms | ActiveRecord: 0.0ms)
15775
+  (0.1ms) rollback transaction
15776
+  (0.0ms) begin transaction
15777
+ Processing by AwesomeTranslations::HandlersController#show as HTML
15778
+ Parameters: {"id"=>"model_handler"}
15779
+ Completed 200 OK in 12ms (Views: 11.7ms | ActiveRecord: 0.0ms)
15780
+  (0.1ms) rollback transaction
15781
+  (0.0ms) begin transaction
15782
+  (0.0ms) rollback transaction
15783
+  (0.0ms) begin transaction
15784
+  (0.0ms) rollback transaction
15785
+  (0.0ms) begin transaction
15786
+  (0.0ms) rollback transaction
15787
+  (0.0ms) begin transaction
15788
+  (0.1ms) rollback transaction
15789
+  (0.0ms) begin transaction
15790
+  (0.0ms) rollback transaction
15791
+  (0.0ms) begin transaction
15792
+  (0.0ms) rollback transaction
15793
+  (0.0ms) begin transaction
15794
+  (0.0ms) rollback transaction
15795
+  (0.0ms) begin transaction
15796
+  (0.0ms) rollback transaction
15797
+  (0.0ms) begin transaction
15798
+  (0.0ms) rollback transaction
15799
+  (0.0ms) begin transaction
15800
+  (0.0ms) rollback transaction
15801
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15802
+  (0.1ms) begin transaction
15803
+  (0.0ms) rollback transaction
15804
+  (0.0ms) begin transaction
15805
+  (0.0ms) rollback transaction
15806
+  (0.0ms) begin transaction
15807
+  (0.0ms) rollback transaction
15808
+  (0.0ms) begin transaction
15809
+  (0.0ms) rollback transaction
15810
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15811
+  (0.1ms) begin transaction
15812
+  (0.0ms) rollback transaction
15813
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15814
+  (0.1ms) begin transaction
15815
+  (0.0ms) rollback transaction
15816
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15817
+  (0.1ms) begin transaction
15818
+  (0.0ms) rollback transaction
15819
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15820
+  (0.1ms) begin transaction
15821
+  (0.1ms) rollback transaction
15822
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15823
+  (0.1ms) begin transaction
15824
+  (0.0ms) rollback transaction
15825
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15826
+  (0.1ms) begin transaction
15827
+  (0.0ms) rollback transaction
15828
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15829
+  (0.1ms) begin transaction
15830
+  (0.0ms) rollback transaction
15831
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15832
+  (0.1ms) begin transaction
15833
+  (0.1ms) rollback transaction
15834
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15835
+  (0.1ms) begin transaction
15836
+  (0.1ms) rollback transaction
15837
+  (0.0ms) begin transaction
15838
+  (0.0ms) rollback transaction
15839
+  (0.0ms) begin transaction
15840
+  (0.0ms) rollback transaction
15841
+  (0.0ms) begin transaction
15842
+  (0.1ms) rollback transaction
@@ -6,6 +6,8 @@ describe AwesomeTranslations::Handlers::LibraryHandler do
6
6
  let(:mailer_group) { handler.groups.select { |group| group.name == "app/mailers/my_mailer.rb" }.first }
7
7
  let(:subject_translation) { mailer_group.translations.select { |translation| translation.key == "my_mailer.mailer_action.custom_subject" }.first }
8
8
  let(:admin_translation) { group.translations.select { |translation| translation.key == "models.role.administrator" }.first }
9
+ let(:application_helper_group) { handler.groups.select { |group| group.name == 'app/helpers/application_helper.rb' }.first }
10
+ let(:hello_world_translation) { application_helper_group.translations.select { |translation| puts "Translation: #{translation}"; translation.key == 'helpers.application_helper.hello_world' }.first }
9
11
 
10
12
  it "finds translations made with the t method" do
11
13
  admin_translation.should_not eq nil
@@ -24,4 +26,8 @@ describe AwesomeTranslations::Handlers::LibraryHandler do
24
26
  expect(moderator_translation).to_not eq nil
25
27
  expect(user_translation).to_not eq nil
26
28
  end
29
+
30
+ it 'finds helpers translations using helper_t' do
31
+ expect(hello_world_translation.key).to eq 'helpers.application_helper.hello_world'
32
+ end
27
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_translations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-13 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -283,7 +283,6 @@ files:
283
283
  - spec/dummy/config/initializers/secret_token.rb
284
284
  - spec/dummy/config/initializers/session_store.rb
285
285
  - spec/dummy/config/initializers/wrap_parameters.rb
286
- - spec/dummy/config/locales/awesome_translations/date_time/da.yml
287
286
  - spec/dummy/config/locales/awesome_translations/date_time/de.yml
288
287
  - spec/dummy/config/locales/awesome_translations/date_time/en.yml
289
288
  - spec/dummy/config/locales/awesome_translations/models/role/da.yml
@@ -548,7 +547,6 @@ files:
548
547
  - spec/dummy/tmp/cache/assets/test/sprockets/v3.0/xoSaAGdIEiGSuQOIsR7F32U5bfhjw8_daxc8TyKjldw.cache
549
548
  - spec/dummy/tmp/cache/assets/test/sprockets/v3.0/zLIiPZHKBB7dMguv8917pHsofobSuT1C_bkatR1QRPw.cache
550
549
  - spec/dummy/tmp/cache/assets/test/sprockets/v3.0/ziuIMdFPkGTyTbAtDx8B7YubNSIvQdzkDOVXUwo7NIE.cache
551
- - spec/dummy/tmp/pids/server.pid
552
550
  - spec/factories/user.rb
553
551
  - spec/handlers/erb_handler_spec.rb
554
552
  - spec/handlers/global_handler_spec.rb
@@ -627,7 +625,6 @@ test_files:
627
625
  - spec/dummy/public/422.html
628
626
  - spec/dummy/public/404.html
629
627
  - spec/dummy/public/favicon.ico
630
- - spec/dummy/tmp/pids/server.pid
631
628
  - spec/dummy/tmp/cache/assets/test/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/application.css.scssc
632
629
  - spec/dummy/tmp/cache/assets/test/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/layout.css.scssc
633
630
  - spec/dummy/tmp/cache/assets/test/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/groups.css.scssc
@@ -896,7 +893,6 @@ test_files:
896
893
  - spec/dummy/config/locales/awesome_translations/number/da.yml
897
894
  - spec/dummy/config/locales/awesome_translations/number/de.yml
898
895
  - spec/dummy/config/locales/awesome_translations/number/en.yml
899
- - spec/dummy/config/locales/awesome_translations/date_time/da.yml
900
896
  - spec/dummy/config/locales/awesome_translations/date_time/de.yml
901
897
  - spec/dummy/config/locales/awesome_translations/date_time/en.yml
902
898
  - spec/dummy/config/locales/awesome_translations/models/role/da.yml
@@ -1,9 +0,0 @@
1
- ---
2
- da:
3
- date:
4
- day_names:
5
- -
6
- - Mandag
7
- -
8
- -
9
- - Torsdag
@@ -1 +0,0 @@
1
- 15402