tuttle 0.0.6 → 0.0.8
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 +5 -5
- data/CHANGELOG.md +17 -0
- data/Rakefile +0 -1
- data/app/controllers/tuttle/active_job_controller.rb +1 -0
- data/app/controllers/tuttle/active_model_serializers_controller.rb +1 -0
- data/app/controllers/tuttle/active_support_controller.rb +1 -0
- data/app/controllers/tuttle/application_controller.rb +19 -2
- data/app/controllers/tuttle/cancancan_controller.rb +2 -0
- data/app/controllers/tuttle/devise_controller.rb +1 -0
- data/app/controllers/tuttle/execjs_controller.rb +12 -0
- data/app/controllers/tuttle/gems_controller.rb +3 -2
- data/app/controllers/tuttle/home_controller.rb +1 -0
- data/app/controllers/tuttle/i18n_controller.rb +27 -0
- data/app/controllers/tuttle/paperclip_controller.rb +1 -0
- data/app/controllers/tuttle/rack_attack_controller.rb +26 -0
- data/app/controllers/tuttle/rack_mini_profiler_controller.rb +1 -0
- data/app/controllers/tuttle/rails_controller.rb +19 -5
- data/app/controllers/tuttle/request_controller.rb +1 -0
- data/app/controllers/tuttle/ruby_controller.rb +15 -2
- data/app/helpers/tuttle/application_helper.rb +64 -2
- data/app/models/tuttle/configuration_registry.rb +1 -0
- data/app/models/tuttle/version_detector.rb +1 -0
- data/app/views/layouts/tuttle/application.html.erb +22 -6
- data/app/views/tuttle/active_support/dependencies.html.erb +7 -7
- data/app/views/tuttle/active_support/inflectors.html.erb +1 -1
- data/app/views/tuttle/cancancan/index.html.erb +1 -1
- data/app/views/tuttle/cancancan/rule_tester.html.erb +3 -3
- data/app/views/tuttle/execjs/index.html.erb +87 -0
- data/app/views/tuttle/gems/http_clients.html.erb +13 -12
- data/app/views/tuttle/gems/index.html.erb +4 -4
- data/app/views/tuttle/gems/json.html.erb +10 -10
- data/app/views/tuttle/home/index.html.erb +6 -6
- data/app/views/tuttle/i18n/_translation_entry.html.erb +10 -0
- data/app/views/tuttle/i18n/index.html.erb +111 -0
- data/app/views/tuttle/i18n/localize.html.erb +53 -0
- data/app/views/tuttle/i18n/translations.html.erb +12 -0
- data/app/views/tuttle/rack_attack/index.html.erb +227 -0
- data/app/views/tuttle/rails/assets.html.erb +4 -4
- data/app/views/tuttle/rails/cache.html.erb +4 -8
- data/app/views/tuttle/rails/controllers.html.erb +54 -7
- data/app/views/tuttle/rails/database.html.erb +14 -1
- data/app/views/tuttle/rails/engines.html.erb +1 -1
- data/app/views/tuttle/rails/helpers.html.erb +1 -1
- data/app/views/tuttle/rails/index.html.erb +72 -19
- data/app/views/tuttle/rails/models.html.erb +150 -73
- data/app/views/tuttle/rails/routes.html.erb +10 -8
- data/app/views/tuttle/rails/schema_cache.html.erb +2 -2
- data/app/views/tuttle/ruby/constants.html.erb +29 -0
- data/app/views/tuttle/ruby/extensions.html.erb +24 -0
- data/app/views/tuttle/ruby/index.html.erb +21 -15
- data/app/views/tuttle/ruby/tuning.html.erb +6 -9
- data/config/routes.rb +15 -1
- data/lib/tuttle.rb +1 -0
- data/lib/tuttle/engine.rb +3 -4
- data/lib/tuttle/instrumenter.rb +3 -1
- data/lib/tuttle/middleware/request_profiler.rb +11 -11
- data/lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb +34 -2
- data/lib/tuttle/presenters/active_record/reflection_presenter.rb +54 -0
- data/lib/tuttle/presenters/active_support/callbacks.rb +26 -0
- data/lib/tuttle/presenters/base_presenter.rb +19 -0
- data/lib/tuttle/presenters/rack_mini_profiler/client_settings.rb +1 -0
- data/lib/tuttle/ruby_prof/fast_call_stack_printer.rb +2 -1
- data/lib/tuttle/version.rb +2 -1
- metadata +27 -18
@@ -20,7 +20,7 @@
|
|
20
20
|
</tr>
|
21
21
|
</table>
|
22
22
|
|
23
|
-
<h3>Autoload Paths
|
23
|
+
<h3>Autoload Paths <span class="badge"><%= ActiveSupport::Dependencies.autoload_paths.size %> directories</span></h3>
|
24
24
|
<p>
|
25
25
|
The set of directories from which we may automatically load files. Files
|
26
26
|
under these directories will be reloaded on each request in development mode,
|
@@ -28,22 +28,22 @@
|
|
28
28
|
</p>
|
29
29
|
<ul>
|
30
30
|
<%- ActiveSupport::Dependencies.autoload_paths.each do |path_name| %>
|
31
|
-
<li><%= path_name %></li>
|
31
|
+
<li><%= display_path(path_name) %></li>
|
32
32
|
<%- end %>
|
33
33
|
</ul>
|
34
34
|
|
35
|
-
<h3>Autoload Once Paths
|
35
|
+
<h3>Autoload Once Paths <span class="badge"><%= ActiveSupport::Dependencies.autoload_once_paths.size %> directories</span></h3>
|
36
36
|
<p>
|
37
37
|
The set of directories from which automatically loaded constants are loaded
|
38
38
|
only once. All directories in this set must also be present in +autoload_paths+.
|
39
39
|
</p>
|
40
40
|
<ul>
|
41
41
|
<%- ActiveSupport::Dependencies.autoload_once_paths.each do |path_name| %>
|
42
|
-
<li><%= path_name %></li>
|
42
|
+
<li><%= display_path(path_name) %></li>
|
43
43
|
<%- end %>
|
44
44
|
</ul>
|
45
45
|
|
46
|
-
<h3>Explicitly Unloadable Constants
|
46
|
+
<h3>Explicitly Unloadable Constants <span class="badge"><%= ActiveSupport::Dependencies.explicitly_unloadable_constants.size %> constants</span></h3>
|
47
47
|
<p>
|
48
48
|
An array of constant names that need to be unloaded on every request. Used
|
49
49
|
to allow arbitrary constants to be marked for unloading.
|
@@ -54,7 +54,7 @@
|
|
54
54
|
<%- end %>
|
55
55
|
</ul>
|
56
56
|
|
57
|
-
<h3>Autoloaded Constants
|
57
|
+
<h3>Autoloaded Constants <span class="badge"><%= ActiveSupport::Dependencies.autoloaded_constants.size %> constants</span></h3>
|
58
58
|
<p>
|
59
59
|
An array of qualified constant names that have been loaded.
|
60
60
|
</p>
|
@@ -64,7 +64,7 @@
|
|
64
64
|
<%- end %>
|
65
65
|
</ul>
|
66
66
|
|
67
|
-
<h3>Loaded files
|
67
|
+
<h3>Loaded files <span class="badge"><%= ActiveSupport::Dependencies.history.size %> files</span></h3>
|
68
68
|
<ul>
|
69
69
|
<% ActiveSupport::Dependencies.history.sort.each do |loaded_file| %>
|
70
70
|
<li><%= loaded_file %><%= ActiveSupport::Dependencies.loaded.include?(loaded_file) ? nil : ' - NOT LOADED' %></li>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<h1>ActiveSupport::Inflection</h1>
|
2
2
|
|
3
3
|
<h2>Example</h2>
|
4
|
-
<form class="form-horizontal" role="form"
|
4
|
+
<form class="form-horizontal" role="form" method="get">
|
5
5
|
<div class="form-group">
|
6
6
|
<label for="test_word" class="col-sm-2 control-label">Test Word</label>
|
7
7
|
<div class="col-sm-10">
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<ul class="nav nav-tabs" role="tablist">
|
4
4
|
<li class="active"><a href="#overview" role="tab" data-toggle="tab">Overview</a></li>
|
5
|
-
<li><a href="#rules" role="tab" data-toggle="tab">Rules
|
5
|
+
<li><a href="#rules" role="tab" data-toggle="tab">Rules <span class="badge"><%= @rules.size %></span></a></li>
|
6
6
|
<li><a href="<%= cancancan_rule_tester_path %>" role="tab">Rule Tester</a></li>
|
7
7
|
</ul>
|
8
8
|
|
@@ -23,7 +23,7 @@
|
|
23
23
|
<div class="form-group">
|
24
24
|
<label for="subject_id" class="col-sm-2 control-label">Subject ID</label>
|
25
25
|
<div class="col-sm-10">
|
26
|
-
<input type="text" class="form-control" name="subject_id" value="<%= @subject.try(:id) || params[:subject_id] %>">
|
26
|
+
<input type="text" class="form-control" name="subject_id" id="subject_id" value="<%= @subject.try(:id) || params[:subject_id] %>">
|
27
27
|
</div>
|
28
28
|
</div>
|
29
29
|
<div class="form-group">
|
@@ -43,7 +43,7 @@
|
|
43
43
|
<%- relevant_rules = @ability.send(:relevant_rules_for_match, @action.to_sym, @subject) -%>
|
44
44
|
|
45
45
|
<h3>Relevant Rules</h3>
|
46
|
-
<%= render :partial => 'rule_table', :locals => {:rules => relevant_rules }
|
46
|
+
<%= render :partial => 'rule_table', :locals => {:rules => relevant_rules } %>
|
47
47
|
|
48
48
|
<h3>All Rules</h3>
|
49
|
-
<%= render :partial => 'rule_table', :locals => {:rules => @ability.instance_variable_get('@rules') }
|
49
|
+
<%= render :partial => 'rule_table', :locals => {:rules => @ability.instance_variable_get('@rules') } %>
|
@@ -0,0 +1,87 @@
|
|
1
|
+
<style>
|
2
|
+
#execjs-runtimes .best_available { font-weight: bold; }
|
3
|
+
</style>
|
4
|
+
|
5
|
+
<h1>ExecJS</h1>
|
6
|
+
|
7
|
+
<p>
|
8
|
+
<a href="https://github.com/rails/execjs">ExecJS</a> lets you run JavaScript code from Ruby.
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
ExecJS automatically picks the best runtime available to evaluate your JavaScript program, then returns the result to you as a Ruby object.
|
12
|
+
</p>
|
13
|
+
<p>
|
14
|
+
You can override the selection process by setting a <code>EXECJS_RUNTIME</code> environment variable.
|
15
|
+
</p>
|
16
|
+
<p>
|
17
|
+
ExecJS is used by gems such as Uglifier and CoffeeScript even if you don't call evaluate JavaScript directly from your own application.
|
18
|
+
</p>
|
19
|
+
|
20
|
+
<div class="panel panel-default">
|
21
|
+
<div class="panel-heading">
|
22
|
+
<h3 class="panel-title">ExecJS Configuration</h3>
|
23
|
+
</div>
|
24
|
+
<div class="panel-body">
|
25
|
+
|
26
|
+
<dl>
|
27
|
+
<dt>ExecJS Version</dt>
|
28
|
+
<dd><code><%= ExecJS::VERSION %></code></dd>
|
29
|
+
|
30
|
+
<dt>Autodetect: (Environment or best-available)</dt>
|
31
|
+
<dd><code><%= ExecJS::Runtimes.autodetect.try(:name) %></code></dd>
|
32
|
+
|
33
|
+
<dt>Best Available: (First non-deprecated, available runtime)</dt>
|
34
|
+
<dd><code><%= ExecJS::Runtimes.best_available.name %></code></dd>
|
35
|
+
|
36
|
+
<dt>From Environment</dt>
|
37
|
+
<dd><code><%= ExecJS::Runtimes.from_environment.try(:name).inspect %></code></dd>
|
38
|
+
|
39
|
+
<dt>ENV["EXECJS_RUNTIME"]: (must match Name in table below)</dt>
|
40
|
+
<dd><code><%= ENV["EXECJS_RUNTIME"].inspect %></code></dd>
|
41
|
+
|
42
|
+
<dt>Platform installed NodeJS (<code>`nodejs --version || node --version`</code>)</dt>
|
43
|
+
<dd><code><%= `(nodejs --version || node --version) 2>/dev/null` %></code></dd>
|
44
|
+
|
45
|
+
</dl>
|
46
|
+
|
47
|
+
<h3>ExecJS Runtimes</h3>
|
48
|
+
<table id="execjs-runtimes" class="table table-compact">
|
49
|
+
<tr>
|
50
|
+
<th>Name</th>
|
51
|
+
<th>Description</th>
|
52
|
+
<th>Selection</th>
|
53
|
+
<th width="99%">Details</th>
|
54
|
+
<th>Deprecated</th>
|
55
|
+
</tr>
|
56
|
+
|
57
|
+
<% ExecJS::Runtimes.names.each do |runtime_name| %>
|
58
|
+
<% runtime = ExecJS::Runtimes.const_get(runtime_name) %>
|
59
|
+
<tr class="<%= runtime.available? ? "success " : "warning" %> <%= runtime == ExecJS::Runtimes.best_available ? "info best_available" : "" %>">
|
60
|
+
<td class="nowrap"><%= runtime_name %></td>
|
61
|
+
<td class="nowrap"><%= runtime.name %></td>
|
62
|
+
<td class="nowrap">
|
63
|
+
<%= true_label(runtime == ExecJS::Runtimes.autodetect, "auto-detected")%>
|
64
|
+
<%= true_label(runtime == ExecJS::Runtimes.best_available, "best available")%>
|
65
|
+
<%= true_label(runtime == ExecJS::Runtimes.from_environment, "from environment")%>
|
66
|
+
</td>
|
67
|
+
<td>
|
68
|
+
<% if runtime.available? %>
|
69
|
+
<details>
|
70
|
+
<summary><%= runtime.class %></summary>
|
71
|
+
<p>
|
72
|
+
Command: <code><%= runtime.instance_variable_get(:@command).try(:inspect) %></code><br/>
|
73
|
+
Runner Path: <code><%= display_path(runtime.instance_variable_get(:@runner_path)) %></code><br/>
|
74
|
+
<!-- Inspect: <code><%= runtime.inspect %></code> -->
|
75
|
+
</p>
|
76
|
+
</details>
|
77
|
+
<% end %>
|
78
|
+
</td>
|
79
|
+
<td><%= truth_label(runtime.deprecated?) %></td>
|
80
|
+
</tr>
|
81
|
+
<% end %>
|
82
|
+
</table>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
<div class="panel-footer">
|
86
|
+
</div>
|
87
|
+
</div>
|
@@ -11,23 +11,24 @@
|
|
11
11
|
Often client libraries are pulled in as dependencies of other gems you've included.
|
12
12
|
</p>
|
13
13
|
|
14
|
-
<p>Libraries detected and loaded</p>
|
15
|
-
<ul>
|
16
|
-
<li
|
17
|
-
<li><a href="https://github.com/excon/excon">Excon</a
|
18
|
-
<li><a href="https://github.com/savonrb/httpi">HTTPI</a
|
19
|
-
<li><a href="https://github.com/nahi/httpclient">httpclient</a
|
20
|
-
<li><a href="https://github.com/typhoeus/typhoeus">Typhoeus</a
|
21
|
-
<li><a href="https://github.com/lostisland/faraday">Faraday</a
|
14
|
+
<p>Libraries detected and loaded are marked in <span class="text-success">green</span></p>
|
15
|
+
<ul class="list-group col-sm-4">
|
16
|
+
<li class="list-group-item list-group-item-<%= defined?(::Net::HTTP) ? 'success' : 'warning' %>">Net::HTTP (core ruby)</li>
|
17
|
+
<li class="list-group-item list-group-item-<%= defined?(::Excon) ? 'success' : 'warning' %>"><a href="https://github.com/excon/excon">Excon</a></li>
|
18
|
+
<li class="list-group-item list-group-item-<%= defined?(::HTTPI) ? 'success' : 'warning' %>"><a href="https://github.com/savonrb/httpi">HTTPI</a></li>
|
19
|
+
<li class="list-group-item list-group-item-<%= defined?(::HTTPClient) ? 'success' : 'warning' %>"><a href="https://github.com/nahi/httpclient">httpclient</a></li>
|
20
|
+
<li class="list-group-item list-group-item-<%= defined?(::Typhoeus) ? 'success' : 'warning' %>"><a href="https://github.com/typhoeus/typhoeus">Typhoeus</a></li>
|
21
|
+
<li class="list-group-item list-group-item-<%= defined?(::Faraday) ? 'success' : 'warning' %>"><a href="https://github.com/lostisland/faraday">Faraday</a>
|
22
22
|
<%- if defined?(Faraday) %>
|
23
23
|
— (Default adapter: <%= Faraday.default_adapter %>)
|
24
24
|
<%- end %>
|
25
25
|
</li>
|
26
|
-
<li><a href="https://github.com/nicksieger/multipart-post">multipart-post</a
|
27
|
-
<li><a href="https://github.com/toland/patron">Patron</a
|
28
|
-
<li><a href="https://github.com/savonrb/savon">Savon</a
|
29
|
-
<li><a href="https://github.com/igrigorik/em-http-request">Event Machine HttpRequest</a
|
26
|
+
<li class="list-group-item list-group-item-<%= defined?(::Net::HTTP::Post::Multipart) ? 'success' : 'warning' %>"><a href="https://github.com/nicksieger/multipart-post">multipart-post</a></li>
|
27
|
+
<li class="list-group-item list-group-item-<%= defined?(::Patron::Session) ? 'success' : 'warning' %>"><a href="https://github.com/toland/patron">Patron</a></li>
|
28
|
+
<li class="list-group-item list-group-item-<%= defined?(::Savon) ? 'success' : 'warning' %>"><a href="https://github.com/savonrb/savon">Savon</a></li>
|
29
|
+
<li class="list-group-item list-group-item-<%= defined?(::EventMachine::HttpRequest) ? 'success' : 'warning' %>"><a href="https://github.com/igrigorik/em-http-request">Event Machine HttpRequest</a></li>
|
30
30
|
</ul>
|
31
|
+
|
31
32
|
</div>
|
32
33
|
<div class="panel-footer">
|
33
34
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<h1>Gems
|
1
|
+
<h1>Gems <span class="badge"><%= @gemspecs.size %></span></h1>
|
2
2
|
|
3
|
-
<table class="table">
|
3
|
+
<table class="table table-striped table-condensed">
|
4
4
|
<tr>
|
5
5
|
<th>Name</th>
|
6
6
|
<th>Version</th>
|
@@ -8,13 +8,13 @@
|
|
8
8
|
<th>License</th>
|
9
9
|
<th>Homepage</th>
|
10
10
|
</tr>
|
11
|
-
<%
|
11
|
+
<% @gemspecs.each do |gemspec| %>
|
12
12
|
<tr>
|
13
13
|
<td class="text-nowrap"><%= gemspec.name %></td>
|
14
14
|
<td><%= gemspec.version.to_s %></td>
|
15
15
|
<td><%= gemspec.summary %></td>
|
16
16
|
<td><%= gemspec.licenses.join(', ') %></td>
|
17
|
-
<td><%= link_to gemspec.homepage, gemspec.homepage
|
17
|
+
<td><%= link_to gemspec.homepage, gemspec.homepage unless gemspec.homepage.blank? %></td>
|
18
18
|
</tr>
|
19
19
|
<% end %>
|
20
20
|
</table>
|
@@ -10,21 +10,21 @@
|
|
10
10
|
Depending on the nature of the JSON you are decoding or objects you are encoding you may see a benefit by using the appropriate library.
|
11
11
|
</p>
|
12
12
|
|
13
|
-
<p>Libraries detected</p>
|
14
|
-
<ul>
|
15
|
-
<li
|
16
|
-
<li
|
17
|
-
<li
|
18
|
-
<li
|
19
|
-
|
20
|
-
<a href="https://github.com/intridea/multi_json">MultiJson</a>: <%= truth_label(defined?(MultiJson)) %>
|
13
|
+
<p>Libraries detected and loaded are marked in <span class="text-success">green</span></p>
|
14
|
+
<ul class="list-group col-sm-4">
|
15
|
+
<li class="list-group-item list-group-item-<%= defined?(::ActiveSupport::JSON) ? 'success' : 'warning' %>">ActiveSupport::JSON</li>
|
16
|
+
<li class="list-group-item list-group-item-<%= defined?(::JSON) && !defined?(::JSON::Pure) ? 'success' : 'warning' %>">JSON</li>
|
17
|
+
<li class="list-group-item list-group-item-<%= defined?(::JSON::Pure) ? 'success' : 'warning' %>">JSON Pure</li>
|
18
|
+
<li class="list-group-item list-group-item-<%= defined?(::MultiJson) ? 'success' : 'warning' %>">
|
19
|
+
<a href="https://github.com/intridea/multi_json">MultiJson</a>
|
21
20
|
<%- if defined?(MultiJson) %>
|
22
21
|
— (Adapter: <%= MultiJson.adapter %>)
|
23
22
|
<%- end %>
|
24
23
|
</li>
|
25
|
-
<li
|
24
|
+
<li class="list-group-item list-group-item-<%= defined?(::Oj) ? 'success' : 'warning' %>"><a href="https://github.com/ohler55/oj">Oj</a></li>
|
25
|
+
<li class="list-group-item list-group-item-<%= defined?(::Yajl) ? 'success' : 'warning' %>"><a href="https://github.com/brianmario/yajl-ruby">Yajl</a></li>
|
26
26
|
</ul>
|
27
|
-
|
27
|
+
|
28
28
|
</div>
|
29
29
|
<div class="panel-footer">
|
30
30
|
</div>
|
@@ -15,10 +15,10 @@
|
|
15
15
|
<p>Caching: <%= truth_label(::ActionController::Base.send(:cache_configured?), 'Enabled', 'Disabled') %></p>
|
16
16
|
</div>
|
17
17
|
<div class="panel-footer">
|
18
|
-
<%= link_to "Configuration", rails_path, :class=>
|
19
|
-
<%= link_to "Database", rails_database_path, :class=>
|
20
|
-
<%= link_to "Asset Pipeline", rails_assets_path, :class=>
|
21
|
-
<%= link_to "Caching", rails_cache_path, :class=>
|
18
|
+
<%= link_to "Configuration", rails_path, :class=> %w(btn btn-primary), :role=>'button' %>
|
19
|
+
<%= link_to "Database", rails_database_path, :class=> %w(btn btn-primary), :role=>'button' %>
|
20
|
+
<%= link_to "Asset Pipeline", rails_assets_path, :class=> %w(btn btn-primary), :role=>'button' %>
|
21
|
+
<%= link_to "Caching", rails_cache_path, :class=> %w(btn btn-primary), :role=>'button' %>
|
22
22
|
</div>
|
23
23
|
</div>
|
24
24
|
|
@@ -78,8 +78,8 @@
|
|
78
78
|
<p>Gems: <%= Bundler.rubygems.all_specs.size %></p>
|
79
79
|
</div>
|
80
80
|
<div class="panel-footer">
|
81
|
-
<%= link_to "Configuration", ruby_path, :class=>
|
82
|
-
<%= link_to "Gems", gems_path, :class=>
|
81
|
+
<%= link_to "Configuration", ruby_path, :class=> %w(btn btn-primary), :role=>'button' %>
|
82
|
+
<%= link_to "Gems", gems_path, :class=> %w(btn btn-primary), :role=>'button' %>
|
83
83
|
</div>
|
84
84
|
</div>
|
85
85
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% k, v = local_assigns[:translation_entry] %>
|
2
|
+
<% if v.is_a? (Hash) %>
|
3
|
+
<li><%= k.inspect %>
|
4
|
+
<ul>
|
5
|
+
<%= render partial: 'translation_entry', collection: v.to_a.sort_by { |entry| "#{entry[1].is_a?(Hash)}-#{entry[0]}" } %>
|
6
|
+
</ul>
|
7
|
+
</li>
|
8
|
+
<% else %>
|
9
|
+
<li><%= k.inspect %> = <%= v.inspect %></li>
|
10
|
+
<% end %>
|
@@ -0,0 +1,111 @@
|
|
1
|
+
<h1>Internationalization</h1>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
Rails Internationalization (I18n) configuration is described in the Rails
|
5
|
+
Guide for the <%= link_to_rails_guide('i18n', 'Rails Internationalization API') %>.
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<dl class="dl-horizontal">
|
9
|
+
<dt>I18n Version</dt><dd><%= I18n::VERSION %></dd>
|
10
|
+
<dt>Rails I18n loaded</dt><dd><%= truth_label(defined?(::RailsI18n)) %></dd>
|
11
|
+
<% if defined?(::RailsI18n) %>
|
12
|
+
<dt>Rails-I18n Version</dt><dd><%= Bundler.rubygems.loaded_specs('rails-i18n').version rescue "Unknown" %></dd>
|
13
|
+
<% end %>
|
14
|
+
</dl>
|
15
|
+
|
16
|
+
<h3>Config Settings</h3>
|
17
|
+
<table class="table table-condensed">
|
18
|
+
<tr>
|
19
|
+
<th>Setting</th>
|
20
|
+
<th>Config</th>
|
21
|
+
<th>Description</th>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td>I18n.default_locale</td>
|
25
|
+
<td><code><%= I18n.default_locale.inspect %></code></td>
|
26
|
+
<td class="nowrap">Default locale</td>
|
27
|
+
</tr>
|
28
|
+
<tr>
|
29
|
+
<td>I18n.default_separator</td>
|
30
|
+
<td><code><%= I18n.default_separator.inspect %></code></td>
|
31
|
+
<td class="nowrap">Default separator (should be <code>.</code>)</td>
|
32
|
+
</tr>
|
33
|
+
<tr>
|
34
|
+
<td>I18n.exception_handler</td>
|
35
|
+
<td><code><%= I18n.exception_handler.class.inspect %></code></td>
|
36
|
+
<td class="nowrap">Exception handler (class)</td>
|
37
|
+
</tr>
|
38
|
+
<tr>
|
39
|
+
<td>I18n.backend</td>
|
40
|
+
<td><code><%= I18n.backend.class.inspect %></code></td>
|
41
|
+
<td>Backend (class)</td>
|
42
|
+
</tr>
|
43
|
+
<tr>
|
44
|
+
<td>I18n.available_locales</td>
|
45
|
+
<td><code><%= I18n.available_locales %></code></td>
|
46
|
+
<td class="nowrap">Available locales</td>
|
47
|
+
</tr>
|
48
|
+
<tr>
|
49
|
+
<td>I18n.enforce_available_locales</td>
|
50
|
+
<td><%= truth_label(I18n.enforce_available_locales) %></td>
|
51
|
+
<td class="nowrap">Enforce available locales</td>
|
52
|
+
</tr>
|
53
|
+
<tr>
|
54
|
+
<td>I18n::Locale::Tag.implementation</td>
|
55
|
+
<td><%= I18n::Locale::Tag.implementation %></td>
|
56
|
+
<td class="nowrap">Locale format support for fallbacks</td>
|
57
|
+
</tr>
|
58
|
+
</table>
|
59
|
+
|
60
|
+
<h3>i18n Extensions</h3>
|
61
|
+
<p>Note: Fallbacks and Pluralization are enabled if the <code>rails-i18n</code> gem is loaded</p>
|
62
|
+
<h4>Fallbacks <%= truth_label(I18n.respond_to?(:fallbacks), "enabled", "not enabled") %></h4>
|
63
|
+
<% if I18n.respond_to?(:fallbacks) %>
|
64
|
+
<table class="table table table-condensed">
|
65
|
+
<% I18n.fallbacks.each do |k, v| %>
|
66
|
+
<tr>
|
67
|
+
<td><code><%= k.inspect %></code></td>
|
68
|
+
<td><code><%= v.inspect %></code></td>
|
69
|
+
</tr>
|
70
|
+
<% end %>
|
71
|
+
</table>
|
72
|
+
<% end %>
|
73
|
+
<h4>Pluralization <%= truth_label(I18n.backend.class < I18n::Backend::Pluralization, "enabled", "not enabled") %></h4>
|
74
|
+
<% if I18n.backend.respond_to?(:pluralize) %>
|
75
|
+
<table class="table table table-condensed">
|
76
|
+
<tr>
|
77
|
+
<th>Locale</th>
|
78
|
+
<th>Plural Keys</th>
|
79
|
+
</tr>
|
80
|
+
<% @sorted_locales.each do |locale| %>
|
81
|
+
<tr>
|
82
|
+
<td><code><%= locale.inspect %></code></td>
|
83
|
+
<td><code><%= I18n.t('i18n.plural.keys', locale: locale) %></code></td>
|
84
|
+
</tr>
|
85
|
+
<% end %>
|
86
|
+
</table>
|
87
|
+
<% end %>
|
88
|
+
|
89
|
+
<h4>Cache <%= truth_label(I18n.respond_to?(:cache_store), "enabled", "not enabled") %></h4>
|
90
|
+
<h4>GetText <%= truth_label(I18n.backend.class < I18n::Backend::Gettext, "enabled", "not enabled") %></h4>
|
91
|
+
|
92
|
+
<% config_paths = Rails.application.config.i18n.load_path.map(&:to_s) %>
|
93
|
+
<h3>I18n load path <span class="badge"><%= I18n.load_path.size %> files</span></h3>
|
94
|
+
<table class="table table table-condensed">
|
95
|
+
<tr>
|
96
|
+
<th>Path</th>
|
97
|
+
<th>Configured</th>
|
98
|
+
<th>Exists</th>
|
99
|
+
<th>File Size</th>
|
100
|
+
</tr>
|
101
|
+
<% I18n.load_path.each do |path_location| %>
|
102
|
+
<tr>
|
103
|
+
<td class="text-nowrap">
|
104
|
+
<%= display_path(path_location) %>
|
105
|
+
</td>
|
106
|
+
<td><%= truth_label(config_paths.include?(path_location)) %></td>
|
107
|
+
<td><%= truth_label(File.exist?(path_location)) %></td>
|
108
|
+
<td><%= File.size(path_location) %></td>
|
109
|
+
</tr>
|
110
|
+
<% end %>
|
111
|
+
</table>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<% date_current = Date.current %>
|
2
|
+
<% time_current = Time.current %>
|
3
|
+
<h1>Localization</h1>
|
4
|
+
<p>
|
5
|
+
Rails will localize Dates and Times using keys scoped under
|
6
|
+
<code>date.format</code> and <code>time.format</code>.
|
7
|
+
Typically the <code>rails-i18n</code> gem will provide the default
|
8
|
+
translations for these translations but they can be overridden.
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
The current date is <code><%= date_current.to_s %></code><br/>
|
12
|
+
The current time is <code><%= time_current.to_s %></code><br/>
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<h3>Dates</h3>
|
16
|
+
<% date_formats = I18n.translate('date.formats', locale: I18n.default_locale) %>
|
17
|
+
<table class="table table table-condensed">
|
18
|
+
<tr>
|
19
|
+
<th>Locale</th>
|
20
|
+
<% date_formats.each do |format, _format_string| %>
|
21
|
+
<th class="nowrap"><%= format.inspect %></th>
|
22
|
+
<% end %>
|
23
|
+
</tr>
|
24
|
+
<% @sorted_locales.each do |locale_name| %>
|
25
|
+
<% locale_date_formats = I18n.translate('date.formats', locale: locale_name, fallback: false) rescue nil %>
|
26
|
+
<tr class="<% 'missing' if locale_date_formats.nil? %>">
|
27
|
+
<td><%= locale_name %></td>
|
28
|
+
<% date_formats.each do |format, _format_string| %>
|
29
|
+
<td class="nowrap"><%= l(date_current, locale: locale_name, format: format) rescue 'translation missing' %></td>
|
30
|
+
<% end %>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
</table>
|
34
|
+
|
35
|
+
<h3>Times</h3>
|
36
|
+
<% time_formats = I18n.translate('time.formats', locale: I18n.default_locale) %>
|
37
|
+
|
38
|
+
<table class="table table table-condensed">
|
39
|
+
<tr>
|
40
|
+
<th>Locale</th>
|
41
|
+
<% time_formats.each do |format, _format_string| %>
|
42
|
+
<th class="nowrap"><%= format.inspect %></th>
|
43
|
+
<% end %>
|
44
|
+
</tr>
|
45
|
+
<% @sorted_locales.each do |locale_name| %>
|
46
|
+
<tr>
|
47
|
+
<td><%= locale_name %></td>
|
48
|
+
<% time_formats.each do |format, _format_string| %>
|
49
|
+
<td class="nowrap"><%= l(time_current, locale: locale_name, format: format) rescue 'translation missing' %></td>
|
50
|
+
<% end %>
|
51
|
+
</tr>
|
52
|
+
<% end %>
|
53
|
+
</table>
|