Various applications of util.template

This is the first bunch for #1276. I'd like to resolve #1281 before doing more.
Merge pull request #1284 from Frenzie/language

Various applications of util.template
Merge pull request #1280 from hwhw/master

fix a case when "ip r" command fails
pull base changes: fix for <code> elements in epubs

needs https://github.com/koreader/koreader-base/pull/284
fixes #1222