Deplate Modules at a2e

Homegrown extensions to Thomas Link’s text processor

Two macros are enough for a very powerful general mechanism of separation of minimal translatable text from meta-structures that don’t interst translators. Others are more narrowly tailored to internals work at a2e.

1 Future

2 To Do

  • provide better documentation for the a2e.rb extension package
    • The inline documentation generated by RDoc is mostly rendered as empty pages when viewed with my browsers. However local of the pure files without a webserver works nicely, especially with a non-fancy text browser like Lynx.

3 Macros of the a2e.rb packages

3.1 Multilinguisation

Some usage examples:

{vok:{ml:From the above results it has been 
recognised that the %1 strand is propagated in 
%(2|mammal-originating strandified cells), and it 
is believed that these are equivalent to the %4 
strands found in the commercially available 
%3.}|B1(G)|pe:{ml:Vero, MDBK and BHK21}|{ml:NB 
vaccine}|B1(K)}

Two macros are enough for a very powerful mechanism of separation of minimal translatable text from meta-structures that don’t interst translators:

ml
multilingual expression: its text argument is the translatable string that may contain enumerated placeholders, %1 %2 %3 etc for variables, and %(1:…|…|…) for functions. Apart from the text argument the ml expression can have an id (identifier) attribute. If an id is supplied.
vok
invokes a multilingual expression and stuffs it with arguments which are supplied to it. The first character after the first expression (that can be an ml macro or a previously defined (by ID attribute) expression, or a builtin command) is the argument separation chacter, in this case ‘|’. Whether the supplied arguments taken are interpreted as functions or variables depends on the ml expression. In the above example, ‘tpe’ is a function that places its first argument as an explaining parenthesis after the expression, encircled by the %(2|….) bracket, which it expands.

By applying the abstractions to the above sentence, it becomes easier to reuse once-translated sentence templates, and these templates themselves are often easier to oversee than the completely expanded structures.

3.1.1 Advanced usage of ml and vok (not all implemented)

3.1.1.1 Enumerations, with special meaning of %9 as last argument

{ml id=etlist ja="%1と%2と%9":%1, %2 and %9}
{vok:etlist|{ml ja=兎:rabbit}|{ml 
ja=馬:horse}|{ml ja=牛:cow}|{ml ja=狐:fox}} ==> 
rabbit, horse, cow and fox
_EOD_

**** Definitions of derived placeholders that are 
made available to translators

#Verbatim wrap=50 <<__END_HEISEI_
{ml id=heisei Y=%(add,1988,%1) M=%(numpad,2,%2) 
MN=%(month_name,%3 D=numpad,2,%3) 
ja="平成%1年%2月%3日":%MN %D, %Y}
_END_HEISEI_

**** Function and variable Placeholders, another 
example

#Verbatim wrap=50 <<_END_FIRMNORM_ 
{vok:{ml id=firmnorm 
ja="%1の%(2:%3規格)":%(2:%3 standard) of 
%1}|{vok:tp|{vok:{ml id=landfirm ja="%1%2":%2 of 
%1}|{ml ja="メキシコ":Mexico}|{vok:{ml id=firm 
ja="%1社":%1 Inc}|ALPES}}|{vok:firm|{ml 
id=chariver ja="チャールスリバー":Charles 
River}}}|link:http://www.alpes.com/standards/spf|SPF}
_END_FIRMNORM_

*** dynamic links

Instead of pointing to a URL literally, we point 
to the identifier of a document (dok).
The URL is looked up and substituted by the 
software.  The following two might lead
to the same result

#Verbatim <<_EOT_
We use {ah 
url="http://a2e.de/adv/deplate":Deplate}.

We use {ah dok=deplate:Deplate}.
_EOT_

** Database Input

We've developped a generic way of silently 
embedding database input in what appears to be 
normal text.

See {ah dok=deplate_dbtab0802} for more 
explanations.

* Resources
#ah

 - {ah url=a2e.rb:a2e extension module} 
   - this links deplate to the a2e database and 
   adds some macros that are useful for separating 
   translatable text from the document and 
   allowing its extraction to translator-editable 
   files
 - {ah dok=tratext:Tratext tools} -- these also 
 parse deplate and specifically the macros defined 
 in the a2e.rb module 
 - {ah dok=a2e_ruby}
 - {ah dok=mktdir}

* Past
#ev_int

 - 2008-02-17 switching between multiple databases 
 by means of the dbnom variable now supported
 - {ev id=deplate_modd070816 dat=2007-08-16 typ=d 
 prs=phm:PILCH Hartmut creates this directory}

deplate
http://a2e.de/adv/deplate/mod
© 2007-08-16 Hartmut PILCH