Martin Atkins (mart) wrote in lj_dev,
Martin Atkins
mart
lj_dev

S2 i18n templates

It'd be pretty cool if we could generate template i18n and i18nc layers (in English) from the layer they are intended to localize. This seems pretty easy apart from one minor issue which I'll over later. However, here's the part of the plan which works:

We already have modifiers on functions, given in square brackets after the parameter list and before the type. I propose that we add a similar modifier capability for properties, like this:

property string text_blah_blah [i18n] {
    ...
}

Given what modifier I used as an example you can probably guess what I'm going to propose for functions:

function server_sig() [i18n] : void;

The above has the problem that at the moment modifiers go on the function implementation header, not the function declaration header. This doesn't matter for global functions (their declaration and implementation are the same thing) but class methods will want this modifier on their declaration so that it can be included as part of the internal class documentation. I don't know if modifiers are valid on method declarations; having them on both would be kinda confusing, anyway, I guess. *shrug*

The minor issue I spoke of before is that the template functions will need to initially have the body of the original S2 function as an example to translators. There's no point in making this template if the translator still has to read the original source to find out what exactly a function is supposed to do. The only real way around this is to include the S2 source in the internal docs for i18n functions, but that's pretty ugly. Any ideas?

The upshot of all this is that then there can be a new option on the Layer Info pages of core and layout layers to get a translation template, which will build an example i18n or i18nc layer containing the English from the original layer which the translator can then edit.

I think this'll make initially creating i18n layers for new layouts a lot easier, and we can also get shot of all of the “i18n layers should override this” junk at the end of lots of the function docstrings.

Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 4 comments