Skip to content

Instantly share code, notes, and snippets.

@glebm
Created June 22, 2014 18:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glebm/bdd3ab6d12d915f0c81b to your computer and use it in GitHub Desktop.
Save glebm/bdd3ab6d12d915f0c81b to your computer and use it in GitHub Desktop.
Missing and unused translations report (i18n-tasks v0.5.0+)
h1 Missing and unused translations
- if @missing.present?
.panel.panel-default
.panel-heading: h3.panel-title #{@missing.leaves.count} missing keys
table.table.table-striped.table-condensed
thead: tr
th.text-right Locale
th Key
th Value
th Type
tbody
- @missing.keys do |key, node|
tr
td.text-right = node.root.key
td = key
td = node.value
td = node.data[:type].to_s.humanize
- else
p.alert.alert-success No translations missing
- if @unused.present?
.panel.panel-default
.panel-heading: h3.panel-title #{@unused.leaves.count} unused keys
table.table.table-striped.table-condensed
thead: tr
th.text-right Locale
th Key
th Value
- @unused.root_key_values.each do |(locale, key, value)|
tr
td.text-right = locale
td = key
td = value
- else
p.alert.alert-success No unused translations
require 'i18n/tasks/base_task'
...
def i18n_status
task = I18n::Tasks::BaseTask.new
@missing = task.missing_keys
@unused = task.unused_keys
end
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment