Skip to content

Instantly share code, notes, and snippets.

@glebm
Last active December 25, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glebm/6887030 to your computer and use it in GitHub Desktop.
Save glebm/6887030 to your computer and use it in GitHub Desktop.
i18n-tasks html report example
require 'i18n/tasks/base_task'
...
def i18n_status
task = I18n::Tasks::BaseTask.new
@missing = task.missing_keys
@unused = task.unused_keys
end
...
h1 I18n report
- if @missing.present?
.panel.panel-default
.panel-heading: h3.panel-title #{@missing.length} missing keys
.panel-body: table.table.table-striped.table-condensed
thead: tr
- @missing[0].attr.keys.each do |key|
th = key.to_s.humanize
tbody
- @missing.each do |k|
tr
- k.attr.values.each do |value|
td = value
- else
p.alert.alert-success No translations missing
- if @unused.present?
.panel.panel-default
.panel-heading: h3.panel-title #{@unused.length} unused keys
.panel-body: table.table.table-striped.table-condensed
thead: tr
th Key
th Value
- @unused.each do |key|
tr
td = key.key
td = key.value
- else
p.alert.alert-success No unused translations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment