3-Round-Stones/callimachus — pull request #94 by amiika (2014-03-18 20:30:11+00:00)
Title: General localization for callimachus

First attempt to add localization plugin (https://github.com/coderifous/jquery-localize) to callimachus.

Currently new locales are created as json to /callimachus/1.3/locales/.
Two examples locale-fi and locale-fr are provided as example (excuse my
French) :)

To support json files, the text.ttl was minimally modified by adding
another media type: "application/json". Instead of adding another media
type to text.ttl, json.ttl could be created to support JSON validation
etc.

Currently only default-layout.xq and layout-functions.xq contains
@data-localize attributes that are used to change the language. Attributes are easily added to any xhtml template. Localization libary could also be used locally in any callimachus application with simple initialization in the template:

$(document).ready(function() {
var locale = localStorage.getItem("callimachus.locale");
$("[data-myAttribute]").localize("filename", { pathPrefix:"PATH_TO_JSON", language: locale});
});

However, it is much simpler adding new @data-localize values to the main json-files. Adding localization to Docbook is bit trickier (suggestions are welcome) and one can ask if docbook should even be supported in the future. At least support for newer wysiwyg editors for html should be added.