Template toolkit translation tools

From Koha Wiki
Jump to navigation Jump to search
Note.jpg

WARNING! This page is obsolete.
This page is no longer correct and exists for historical reasons only.

Template toolkit translation tools

This page is concerned with the migration of the translation tools from HTML template pro to Template Toolkit, for the templates themselves see Template_toolkit_test

There is still quite a bit of work to be done

TODO / issues

Task Script(s) progress Details
Javascript parsing TmplTokenizer.pm - currently the javascript functionality from the old TmplTokenizer (split_js and identify_js_translatable) still exists but is not yet used by next_token
Closing tag representation TTParser.pm / LangInstaller.pm started closing tags are missbehaving in the current TTParser, they are put into a TmplToken's string in their origional form but are not put back into the installed template
Newline issue TmplTokenizer.pm fixed installing a language spits out a 'correct' file but with no new lines, is the result of folding down whitespace in string_canon added string_canon_safe for use internally that does NOT compact newlines
HTML tag attributes TTParser.pm / TmplTokenizer.pm - the attributes for HTML tags are easily available through HTML:Parser however the other translation scripts expect them in a specific format (they rely heavily on regex)
Representation of other tokens TTParser.pm / TmplTokenizer.pm - Processing instructions and PCDATA, as well as others, are currently not represented.
TmplToken attributes TTParser.pm / TmplTokenizer.pm / TmplToken.pm - Not all the attributes within TmplToken are set as they should be
installation issues Langinstaller.pm lines 132 and 174 - Uninitialized value $prefs_name in concat
unitinitialized value xgetext.pl line 105 - $tag seems to be undefined and creating a language really complains about it


Structure

TTParser.pm is a subclass of HTML::Parser and deals with extracting tokens, setting their type and exposing them via the methods next_token, peek_token, unshift_token.

TmplTokenizer.pm deals with interfacing between the other translation tools and TTParser, parametrizing the tokens (if enabled, can group many tokens into a single one) as well as provider helper methods/functions used by the other translation tools.