aboutsummaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2014-05-19 09:17:12 +0200
committerJochen Topf <jochen@topf.org>2014-05-19 09:17:12 +0200
commit39dc0d1af37cf3bcf3d8789cc6d1828d95349292 (patch)
tree8df7196feed5615366a85f7d37a2c87e7ec14e01 /web/lib
parent26737986b64effc3c424e3518672ab132fd9afd6 (diff)
downloadtaginfo-39dc0d1af37cf3bcf3d8789cc6d1828d95349292.tar
taginfo-39dc0d1af37cf3bcf3d8789cc6d1828d95349292.tar.gz
Add translations overview
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/ui/taginfo.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/web/lib/ui/taginfo.rb b/web/lib/ui/taginfo.rb
index 2e61d1a..e688f82 100644
--- a/web/lib/ui/taginfo.rb
+++ b/web/lib/ui/taginfo.rb
@@ -1,6 +1,16 @@
# web/lib/ui/taginfo.rb
class Taginfo < Sinatra::Base
+ def count_texts(data)
+ data.values.map{ |value|
+ if value.is_a?(Hash)
+ count_texts(value)
+ else
+ 1
+ end
+ }.inject(0, :+)
+ end
+
def i18n_walk(line, level, path, en, other)
out = ''
en.keys.sort.each do |key|
@@ -43,6 +53,20 @@ class Taginfo < Sinatra::Base
end
end
+ get '/taginfo/translations' do
+ @title = 'Translations Overview'
+ @section = 'taginfo'
+ @section_title = t.taginfo.meta
+
+ @num_texts = {}
+ r18n.available_locales.each do |lang|
+ data = YAML.load_file("i18n/#{lang.code}.yml")
+ @num_texts[lang.code] = count_texts(data)
+ end
+
+ erb :'taginfo/translations'
+ end
+
get '/taginfo/i18n' do
@title = 'Translations of taginfo texts'
@section = 'taginfo'