M
Michal Suchanek
Hello,
I am not a believer in translations but given that I can write
decently in two languages I could write a multilingual application
that is intelligible as well and could be possibly translated to other
languages later.
However, there is no usable translation framework I am aware of.
I know that there are gettext bindings and I used the equivalent of
gettext in the past:
def xl msg
xl_hash[msg] ? xl_hash[msg] : msg
end
puts (xl(some_message) %(arg, arg, ...))
However, this is inherently broken.
Suppose that some_message reads:
"%s %i %s from %s to %s.
and the arguments would be, in order {Moving|Copying} <a number>
{files|directories|files and directories} <source location> <target
location>.
The first problem here is that this is a sentence with parametrized
verb, and verbs have predetermined location in the sentence different
across languages. It is at the start in English and at the end in
Japanese meaning that the parameter order is different when the
sentence is translated.
In this simple case it would be easy to make two messages, one for
moving and another for copying but some messages may be quite long and
use more than two different verbs which would explode the number of
strings that have to be written, stored and updated considerably.
A number is not really a problem. In some cases really large numbers
might take up a lot of space and would require the message to be
(re)wrapped. A workaround is to use some engineering or vague notation
like 3k, 3E3, about 3 thousands, ... and make sure to leave enough
room for the longest possible such notation. The problem with "about 3
thousands" is that the length is again language dependent (and that
the numeral needs to be localized) but it's much more readable than
the raw figure when you get to some numbers like 1M and even shorter
when you get to numbers like 1T.
The {files|directories|files and directories} is a tough one. First
problem is in the case there is only one item - an alternative of
{file|directory} is needed. In some languages there are more forms
than a singular and a plural (a la English 1st 2nd 3rd 4th .. 10th
11th 12th .. 20th 21st 22nd 23rd .. .. note the inconsistency). To add
insult to the injury not all languages put the numeral in front of the
counted item (eg. in Japanese as far as I understand it "%i files"
would be something "=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AE%i=E5=86=
=8A" meaning the numeral is actually embedded
inside the part saying "files"!).
The last two are quite easy, I do not know any language where the
locations would cause trouble except you may need to migrate them to a
different place in the sentence.
Seriously, I don't expect there is a translation framework that
handles all of this.
But if there is one that can generate sentences that don't read
completely ridiculous and can be translated into various languages I
would like to hear about it.
Thanks
Michal
I am not a believer in translations but given that I can write
decently in two languages I could write a multilingual application
that is intelligible as well and could be possibly translated to other
languages later.
However, there is no usable translation framework I am aware of.
I know that there are gettext bindings and I used the equivalent of
gettext in the past:
def xl msg
xl_hash[msg] ? xl_hash[msg] : msg
end
puts (xl(some_message) %(arg, arg, ...))
However, this is inherently broken.
Suppose that some_message reads:
"%s %i %s from %s to %s.
and the arguments would be, in order {Moving|Copying} <a number>
{files|directories|files and directories} <source location> <target
location>.
The first problem here is that this is a sentence with parametrized
verb, and verbs have predetermined location in the sentence different
across languages. It is at the start in English and at the end in
Japanese meaning that the parameter order is different when the
sentence is translated.
In this simple case it would be easy to make two messages, one for
moving and another for copying but some messages may be quite long and
use more than two different verbs which would explode the number of
strings that have to be written, stored and updated considerably.
A number is not really a problem. In some cases really large numbers
might take up a lot of space and would require the message to be
(re)wrapped. A workaround is to use some engineering or vague notation
like 3k, 3E3, about 3 thousands, ... and make sure to leave enough
room for the longest possible such notation. The problem with "about 3
thousands" is that the length is again language dependent (and that
the numeral needs to be localized) but it's much more readable than
the raw figure when you get to some numbers like 1M and even shorter
when you get to numbers like 1T.
The {files|directories|files and directories} is a tough one. First
problem is in the case there is only one item - an alternative of
{file|directory} is needed. In some languages there are more forms
than a singular and a plural (a la English 1st 2nd 3rd 4th .. 10th
11th 12th .. 20th 21st 22nd 23rd .. .. note the inconsistency). To add
insult to the injury not all languages put the numeral in front of the
counted item (eg. in Japanese as far as I understand it "%i files"
would be something "=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AE%i=E5=86=
=8A" meaning the numeral is actually embedded
inside the part saying "files"!).
The last two are quite easy, I do not know any language where the
locations would cause trouble except you may need to migrate them to a
different place in the sentence.
Seriously, I don't expect there is a translation framework that
handles all of this.
But if there is one that can generate sentences that don't read
completely ridiculous and can be translated into various languages I
would like to hear about it.
Thanks
Michal