Re: Translating labels with inserted widgets



> [: Andre Klapper :]
> Some dialogs are based on an English sentence structure, consisting of
> several dropdown widgets.
> [...]
> I am not aware of a way to change the order of the dropdown widgets
> depending on the language/locale.
>
> A friend came up with this basic idea of a framework, however I wonder if
> anybody knows how other systems handle this problem?

No other systems handle this problem.

There are actually two distnict problems, and both were implied in the said
bug report. The first is the problem Priscilla reported, of widget and label
ordering. The second problem is grammar congruence between labels and
widgets, as Friedel noted.

The problem of widget and label ordering could be handled as follows. Each
"widgeted sentence" can be split into N widgets and N + 1 labels. One or
more labels might be empty in English, but all of them should be exposed for
translation, with proper comments and contexts. Additionally there should be
a meta-message per widget, asking the translator to indicate the widget to
fit at that position. These label and widget selection messages should be
interweaved in proper order. For example, if the widgeted sentence is:

  Repeat each [Monday|Tuesday|...] in [January|February...]

the PO file would contain:

  #. TRANSLATORS: Assembly of widgeted sentence
  #.   "Repeat each [weekday] in [month]"
  #. This is the label before the first widget.
  msgctxt "ws-repeateach-label-1"
  msgid "Repeat each"
  msgstr ""

  #. TRANSLATORS: Assembly of widgeted sentence
  #.   "Repeat each [weekday] in [month]"
  #. This is the first widget, translate as 1 for [weekday] or 2 for [month].
  msgctxt "ws-repeateach-widget-1"
  msgid "1"
  msgstr ""

  #. TRANSLATORS: Assembly of widgeted sentence
  #.   "Repeat each [weekday] in [month]"
  #. This is the label between the first and the second widget.
  msgctxt "ws-repeateach-label-2"
  msgid "in"
  msgstr ""

  #. TRANSLATORS: Assembly of widgeted sentence
  #.   "Repeat each [weekday] in [month]"
  #. This is the second widget, translate as 1 for [weekday] or 2 for [month].
  msgctxt "ws-repeateach-widget-2"
  msgid "2"
  msgstr ""

  #. TRANSLATORS: Assembly of widgeted sentence
  #.   "Repeat each [weekday] in [month]"
  #. This is the label after the second widget.
  msgctxt "ws-repeateach-label-3"
  msgid " "
  msgstr ""

It would be nicer if widget selection messages would ask for literal
"[weekday]" and "[month]" instead of numbers, but then unwary translators
would likely screw it up. In this way, there is little to screw up for the
unwary. The empty label message needs one space, or else it would record as
untranslated in statistics.

The problem of grammar congruence between widgets and labels is the harder
one. In the above example, in my language the first label ("Repeat each")
would have to change as the first widget selection ([weekday]) changes,
because the pronoun "each" has to conform to gender of the week day (some
are masculine, other are feminine). To handle this generally for all
languages, heavy artillery is required. Here comes the shameless plug, for
which I'm writing this reply in the first place:

http://sourceforge.net/mailarchive/message.php?msg_id=27932895

Specifically pertinent to widgeted sentences is the bit about "runtime
contexts".

-- 
Chusslove Illich (Часлав Илић)

Attachment: signature.asc
Description: This is a digitally signed message part.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]