With much of Scatterand's UI provided by HTML documents, we need to localize HTML provided by both the built-in templates and the included forms. Components that need to be localized include *at minimum*:
_( )-wrapped strings in 00-webui.js
Body text (non-whitespace text nodes) in forms and templates
_()-wrapped text in value attributes in forms and templates
It would be good to use gettext as part of this process, so that localization is consistent across components, however:
(a) it is impractical to localize documents every time we serve them; we would need to localize everything once and serve the localized copies
(b) we don't want a hard dependency on gettext, since a lot of web servers won't have it installed. If gettext isn't available, we'll fall back to non-localized english strings.
This is fixed. The build script now extracts translatable text from HTML files in the data/form and data/template directories. continuous, non-empty text node is converted into a translatable string. When serving forms and templates, these strings are translated, and the results cached in ~/.scatterand/ translations/ $(LOCALE) . 00-webui.js is scraped using xgettext during the build process; the translations are substituted textually when serving the script, and the results also cached.