Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Base 8 is just like base 10, if you are missing two fingers. -- Tom Lehrer


devel / comp.lang.tcl / Reversed translation in msgcat

SubjectAuthor
* Reversed translation in msgcatAlexandru
`* Reversed translation in msgcatrene
 `* Reversed translation in msgcatAlexandru
  `* Reversed translation in msgcatHarald Oehlmann
   `* Reversed translation in msgcatAlexandru
    `* Reversed translation in msgcatnemethi
     +* Reversed translation in msgcatAlexandru
     |`* Reversed translation in msgcatnemethi
     | `* Reversed translation in msgcatAlexandru
     |  `* Reversed translation in msgcatAlex P
     |   `* Reversed translation in msgcatAlexandru
     |    `- Reversed translation in msgcatAlex P
     `* Reversed translation in msgcatRalf Fassel
      `- Reversed translation in msgcatAlexandru

1
Reversed translation in msgcat

<cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12178&group=comp.lang.tcl#12178

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:1a9e:b0:410:9ecd:3c82 with SMTP id s30-20020a05622a1a9e00b004109ecd3c82mr75837qtc.5.1695318714584;
Thu, 21 Sep 2023 10:51:54 -0700 (PDT)
X-Received: by 2002:a05:6808:d49:b0:3a3:e17e:d2f7 with SMTP id
w9-20020a0568080d4900b003a3e17ed2f7mr2922216oik.4.1695318714338; Thu, 21 Sep
2023 10:51:54 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Thu, 21 Sep 2023 10:51:53 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2001:9e8:892d:a600:f4ab:97ba:9a63:bd4b;
posting-account=glPZ8goAAADztwA3kVEZPMKXCGydx5DU
NNTP-Posting-Host: 2001:9e8:892d:a600:f4ab:97ba:9a63:bd4b
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
Subject: Reversed translation in msgcat
From: alexandr...@meshparts.de (Alexandru)
Injection-Date: Thu, 21 Sep 2023 17:51:54 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1347
 by: Alexandru - Thu, 21 Sep 2023 17:51 UTC

Is there a way to reverse the function "mc" in msgcat?
So to get the original string based on the already translated string.
The translated string was created applying the "mc" function on the original string.
Having the result of "mc" can I found out what was the original string?

Many thanks
Alexandru

Re: Reversed translation in msgcat

<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12179&group=comp.lang.tcl#12179

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:178f:b0:76f:52f:3f86 with SMTP id ay15-20020a05620a178f00b0076f052f3f86mr103516qkb.9.1695361942332;
Thu, 21 Sep 2023 22:52:22 -0700 (PDT)
X-Received: by 2002:a4a:c810:0:b0:57b:66fb:5e25 with SMTP id
s16-20020a4ac810000000b0057b66fb5e25mr959065ooq.1.1695361941994; Thu, 21 Sep
2023 22:52:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Thu, 21 Sep 2023 22:52:21 -0700 (PDT)
In-Reply-To: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=212.243.175.74; posting-account=cY1uRgoAAAD1PpfCHRSABChlMQs7_rU7
NNTP-Posting-Host: 212.243.175.74
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com>
Subject: Re: Reversed translation in msgcat
From: r.zaums...@gmail.com (rene)
Injection-Date: Fri, 22 Sep 2023 05:52:22 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 15
 by: rene - Fri, 22 Sep 2023 05:52 UTC

Alexandru schrieb am Donnerstag, 21. September 2023 um 19:51:57 UTC+2:
> Is there a way to reverse the function "mc" in msgcat?
> So to get the original string based on the already translated string.
> The translated string was created applying the "mc" function on the original string.
> Having the result of "mc" can I found out what was the original string?
>
> Many thanks
> Alexandru
AFAIK not directly.But you could intercept the msgcat::mc call like:

rename ::msgcat::mc ::msgcat::mc1
proc ::msgcat::mc args {
set result [::msgcat::mc1 {*}$args]
# here you have the original $args and the translated string in $result
return $result
}

Re: Reversed translation in msgcat

<14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12180&group=comp.lang.tcl#12180

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ac8:7fc7:0:b0:417:b53c:5d4c with SMTP id b7-20020ac87fc7000000b00417b53c5d4cmr20906qtk.1.1695362887689;
Thu, 21 Sep 2023 23:08:07 -0700 (PDT)
X-Received: by 2002:a9d:6944:0:b0:6b9:182b:cebc with SMTP id
p4-20020a9d6944000000b006b9182bcebcmr2293332oto.7.1695362887442; Thu, 21 Sep
2023 23:08:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Thu, 21 Sep 2023 23:08:06 -0700 (PDT)
In-Reply-To: <91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:9e8:8934:8200:25ea:af01:ccc2:d93b;
posting-account=glPZ8goAAADztwA3kVEZPMKXCGydx5DU
NNTP-Posting-Host: 2001:9e8:8934:8200:25ea:af01:ccc2:d93b
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com> <91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
Subject: Re: Reversed translation in msgcat
From: alexandr...@meshparts.de (Alexandru)
Injection-Date: Fri, 22 Sep 2023 06:08:07 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2570
 by: Alexandru - Fri, 22 Sep 2023 06:08 UTC

rene schrieb am Freitag, 22. September 2023 um 07:52:25 UTC+2:
> Alexandru schrieb am Donnerstag, 21. September 2023 um 19:51:57 UTC+2:
> > Is there a way to reverse the function "mc" in msgcat?
> > So to get the original string based on the already translated string.
> > The translated string was created applying the "mc" function on the original string.
> > Having the result of "mc" can I found out what was the original string?
> >
> > Many thanks
> > Alexandru
> AFAIK not directly.But you could intercept the msgcat::mc call like:
>
> rename ::msgcat::mc ::msgcat::mc1
> proc ::msgcat::mc args {
> set result [::msgcat::mc1 {*}$args]
> # here you have the original $args and the translated string in $result
> return $result
> }
I get it: I would have to save the results of mc to an array or dict.
But this is not going to work for me.
I'm supprised, that this revesed translation is not aready standard.
I need it to save some user settings from the GUI to a file and the restore them from the file to the GUI.
Since the GUI values are translated (let's say to German), I don't want to write gernan names to the file.
The next user might switch to English so the the saved german words are meaningless.

Re: Reversed translation in msgcat

<uejd1f$2bns$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12181&group=comp.lang.tcl#12181

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wortka...@yahoo.com (Harald Oehlmann)
Newsgroups: comp.lang.tcl
Subject: Re: Reversed translation in msgcat
Date: Fri, 22 Sep 2023 08:42:57 +0200
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <uejd1f$2bns$1@dont-email.me>
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com>
<14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 22 Sep 2023 06:42:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2c035cd858b6b414aebc02b20f9a015f";
logging-data="77564"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PzMPR5m8E6AVwhw+WOhhO"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:hpRDorgDbsEMlBi1fOWonctfckY=
Content-Language: en-GB
In-Reply-To: <14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
 by: Harald Oehlmann - Fri, 22 Sep 2023 06:42 UTC

Am 22.09.2023 um 08:08 schrieb Alexandru:
> rene schrieb am Freitag, 22. September 2023 um 07:52:25 UTC+2:
>> Alexandru schrieb am Donnerstag, 21. September 2023 um 19:51:57 UTC+2:
>>> Is there a way to reverse the function "mc" in msgcat?
>>> So to get the original string based on the already translated string.
>>> The translated string was created applying the "mc" function on the original string.
>>> Having the result of "mc" can I found out what was the original string?
>>>
>>> Many thanks
>>> Alexandru
>> AFAIK not directly.But you could intercept the msgcat::mc call like:
>>
>> rename ::msgcat::mc ::msgcat::mc1
>> proc ::msgcat::mc args {
>> set result [::msgcat::mc1 {*}$args]
>> # here you have the original $args and the translated string in $result
>> return $result
>> }
> I get it: I would have to save the results of mc to an array or dict.
> But this is not going to work for me.
> I'm supprised, that this revesed translation is not aready standard.
> I need it to save some user settings from the GUI to a file and the restore them from the file to the GUI.
> Since the GUI values are translated (let's say to German), I don't want to write gernan names to the file.
> The next user might switch to English so the the saved german words are meaningless.

Hi Alexandru,
thank you for the question.
On the practical side, msgcat maintains a dict.
You want an access function to the values and get the keys.
This is doable.

I personally only use Language Tags, e.g.
mc errFile $err

and

mcflset errFile "File error: %s"

So, this would not help you.

Take care,
Harald

Re: Reversed translation in msgcat

<d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12182&group=comp.lang.tcl#12182

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:1a05:b0:412:31bf:104 with SMTP id f5-20020a05622a1a0500b0041231bf0104mr102998qtb.5.1695387320897;
Fri, 22 Sep 2023 05:55:20 -0700 (PDT)
X-Received: by 2002:a05:6808:1407:b0:3ad:eae0:3317 with SMTP id
w7-20020a056808140700b003adeae03317mr3921860oiv.5.1695387320685; Fri, 22 Sep
2023 05:55:20 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Fri, 22 Sep 2023 05:55:20 -0700 (PDT)
In-Reply-To: <uejd1f$2bns$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:9e8:8934:8200:25ea:af01:ccc2:d93b;
posting-account=glPZ8goAAADztwA3kVEZPMKXCGydx5DU
NNTP-Posting-Host: 2001:9e8:8934:8200:25ea:af01:ccc2:d93b
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com> <14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
<uejd1f$2bns$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
Subject: Re: Reversed translation in msgcat
From: alexandr...@meshparts.de (Alexandru)
Injection-Date: Fri, 22 Sep 2023 12:55:20 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 43
 by: Alexandru - Fri, 22 Sep 2023 12:55 UTC

Harald Oehlmann schrieb am Freitag, 22. September 2023 um 08:43:01 UTC+2:
> Am 22.09.2023 um 08:08 schrieb Alexandru:
> > rene schrieb am Freitag, 22. September 2023 um 07:52:25 UTC+2:
> >> Alexandru schrieb am Donnerstag, 21. September 2023 um 19:51:57 UTC+2:
> >>> Is there a way to reverse the function "mc" in msgcat?
> >>> So to get the original string based on the already translated string.
> >>> The translated string was created applying the "mc" function on the original string.
> >>> Having the result of "mc" can I found out what was the original string?
> >>>
> >>> Many thanks
> >>> Alexandru
> >> AFAIK not directly.But you could intercept the msgcat::mc call like:
> >>
> >> rename ::msgcat::mc ::msgcat::mc1
> >> proc ::msgcat::mc args {
> >> set result [::msgcat::mc1 {*}$args]
> >> # here you have the original $args and the translated string in $result
> >> return $result
> >> }
> > I get it: I would have to save the results of mc to an array or dict.
> > But this is not going to work for me.
> > I'm supprised, that this revesed translation is not aready standard.
> > I need it to save some user settings from the GUI to a file and the restore them from the file to the GUI.
> > Since the GUI values are translated (let's say to German), I don't want to write gernan names to the file.
> > The next user might switch to English so the the saved german words are meaningless.
> Hi Alexandru,
> thank you for the question.
> On the practical side, msgcat maintains a dict.
> You want an access function to the values and get the keys.
> This is doable.
>
> I personally only use Language Tags, e.g.
> mc errFile $err
>
> and
>
> mcflset errFile "File error: %s"
>
> So, this would not help you.
>
> Take care,
> Harald
Thanks Harald.
Would id be a good idea to add a new function to msgcat that does the above?

Re: Reversed translation in msgcat

<uek7mp$fisq$1@tota-refugium.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12183&group=comp.lang.tcl#12183

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.tota-refugium.de!.POSTED!not-for-mail
From: csaba.ne...@t-online.de (nemethi)
Newsgroups: comp.lang.tcl
Subject: Re: Reversed translation in msgcat
Date: Fri, 22 Sep 2023 16:18:01 +0200
Message-ID: <uek7mp$fisq$1@tota-refugium.de>
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com>
<14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
<uejd1f$2bns$1@dont-email.me>
<d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 22 Sep 2023 14:18:01 -0000 (UTC)
Injection-Info: tota-refugium.de;
logging-data="510874"; mail-complaints-to="abuse@news.tota-refugium.de"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:aqBErkbHu5FFbsePuVsYaRcHYo4=
In-Reply-To: <d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
Content-Language: en-US
X-User-ID: eJwFwYkBgDAIA8CVipA0jiPf/iN4B6exbhAMLDZsAqfJNM1pfFkuwWxb03J7+Ryf1MQtefwTHRCn
 by: nemethi - Fri, 22 Sep 2023 14:18 UTC

Am 22.09.23 um 14:55 schrieb Alexandru:
> Harald Oehlmann schrieb am Freitag, 22. September 2023 um 08:43:01 UTC+2:
>> Am 22.09.2023 um 08:08 schrieb Alexandru:
>>> rene schrieb am Freitag, 22. September 2023 um 07:52:25 UTC+2:
>>>> Alexandru schrieb am Donnerstag, 21. September 2023 um 19:51:57 UTC+2:
>>>>> Is there a way to reverse the function "mc" in msgcat?
>>>>> So to get the original string based on the already translated string.
>>>>> The translated string was created applying the "mc" function on the original string.
>>>>> Having the result of "mc" can I found out what was the original string?
>>>>>
>>>>> Many thanks
>>>>> Alexandru
>>>> AFAIK not directly.But you could intercept the msgcat::mc call like:
>>>>
>>>> rename ::msgcat::mc ::msgcat::mc1
>>>> proc ::msgcat::mc args {
>>>> set result [::msgcat::mc1 {*}$args]
>>>> # here you have the original $args and the translated string in $result
>>>> return $result
>>>> }
>>> I get it: I would have to save the results of mc to an array or dict.
>>> But this is not going to work for me.
>>> I'm supprised, that this revesed translation is not aready standard.
>>> I need it to save some user settings from the GUI to a file and the restore them from the file to the GUI.
>>> Since the GUI values are translated (let's say to German), I don't want to write gernan names to the file.
>>> The next user might switch to English so the the saved german words are meaningless.
>> Hi Alexandru,
>> thank you for the question.
>> On the practical side, msgcat maintains a dict.
>> You want an access function to the values and get the keys.
>> This is doable.
>>
>> I personally only use Language Tags, e.g.
>> mc errFile $err
>>
>> and
>>
>> mcflset errFile "File error: %s"
>>
>> So, this would not help you.
>>
>> Take care,
>> Harald
> Thanks Harald.
> Would id be a good idea to add a new function to msgcat that does the above?

No.

It is correct that the settings should be kept in English only. OTOH, I
don't see the need for reverse translation, for at least two reasons:

1. If a settings value was selected, e.g., from a combobox, then you
should save the combobox index or some other unique identifier rather
than the corresponding English text in the settings file. Populating
the combobox with language-specific strings should be part of your
locale-switching implementation.

2. It is a common case that a translated text corresponds to more than
one original (English) text. Which one should then be returned by the
reverse translation? Or can you always guarantee that the message
catalogue is a one-to-one mapping?

GUI toolkits like Gtk or Qt make extensive use of message catalogues.
AFAIK, they have no reverse translation functionality either.

--
Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de

Re: Reversed translation in msgcat

<aa322a83-d94d-477a-9ef8-50f3514694ben@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12184&group=comp.lang.tcl#12184

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:1992:b0:417:981f:d56 with SMTP id u18-20020a05622a199200b00417981f0d56mr112031qtc.1.1695393217333;
Fri, 22 Sep 2023 07:33:37 -0700 (PDT)
X-Received: by 2002:a05:6808:1514:b0:3ac:a376:707a with SMTP id
u20-20020a056808151400b003aca376707amr4333503oiw.10.1695393217099; Fri, 22
Sep 2023 07:33:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Fri, 22 Sep 2023 07:33:36 -0700 (PDT)
In-Reply-To: <uek7mp$fisq$1@tota-refugium.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:9e8:8934:8200:25ea:af01:ccc2:d93b;
posting-account=glPZ8goAAADztwA3kVEZPMKXCGydx5DU
NNTP-Posting-Host: 2001:9e8:8934:8200:25ea:af01:ccc2:d93b
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com> <14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
<uejd1f$2bns$1@dont-email.me> <d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
<uek7mp$fisq$1@tota-refugium.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <aa322a83-d94d-477a-9ef8-50f3514694ben@googlegroups.com>
Subject: Re: Reversed translation in msgcat
From: alexandr...@meshparts.de (Alexandru)
Injection-Date: Fri, 22 Sep 2023 14:33:37 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 5063
 by: Alexandru - Fri, 22 Sep 2023 14:33 UTC

nemethi schrieb am Freitag, 22. September 2023 um 16:18:06 UTC+2:
> Am 22.09.23 um 14:55 schrieb Alexandru:
> > Harald Oehlmann schrieb am Freitag, 22. September 2023 um 08:43:01 UTC+2:
> >> Am 22.09.2023 um 08:08 schrieb Alexandru:
> >>> rene schrieb am Freitag, 22. September 2023 um 07:52:25 UTC+2:
> >>>> Alexandru schrieb am Donnerstag, 21. September 2023 um 19:51:57 UTC+2:
> >>>>> Is there a way to reverse the function "mc" in msgcat?
> >>>>> So to get the original string based on the already translated string.
> >>>>> The translated string was created applying the "mc" function on the original string.
> >>>>> Having the result of "mc" can I found out what was the original string?
> >>>>>
> >>>>> Many thanks
> >>>>> Alexandru
> >>>> AFAIK not directly.But you could intercept the msgcat::mc call like:
> >>>>
> >>>> rename ::msgcat::mc ::msgcat::mc1
> >>>> proc ::msgcat::mc args {
> >>>> set result [::msgcat::mc1 {*}$args]
> >>>> # here you have the original $args and the translated string in $result
> >>>> return $result
> >>>> }
> >>> I get it: I would have to save the results of mc to an array or dict.
> >>> But this is not going to work for me.
> >>> I'm supprised, that this revesed translation is not aready standard.
> >>> I need it to save some user settings from the GUI to a file and the restore them from the file to the GUI.
> >>> Since the GUI values are translated (let's say to German), I don't want to write gernan names to the file.
> >>> The next user might switch to English so the the saved german words are meaningless.
> >> Hi Alexandru,
> >> thank you for the question.
> >> On the practical side, msgcat maintains a dict.
> >> You want an access function to the values and get the keys.
> >> This is doable.
> >>
> >> I personally only use Language Tags, e.g.
> >> mc errFile $err
> >>
> >> and
> >>
> >> mcflset errFile "File error: %s"
> >>
> >> So, this would not help you.
> >>
> >> Take care,
> >> Harald
> > Thanks Harald.
> > Would id be a good idea to add a new function to msgcat that does the above?
> No.
>
> It is correct that the settings should be kept in English only. OTOH, I
> don't see the need for reverse translation, for at least two reasons:
>
> 1. If a settings value was selected, e.g., from a combobox, then you
> should save the combobox index or some other unique identifier rather
> than the corresponding English text in the settings file. Populating
> the combobox with language-specific strings should be part of your
> locale-switching implementation.
>
> 2. It is a common case that a translated text corresponds to more than
> one original (English) text. Which one should then be returned by the
> reverse translation? Or can you always guarantee that the message
> catalogue is a one-to-one mapping?
>
> GUI toolkits like Gtk or Qt make extensive use of message catalogues.
> AFAIK, they have no reverse translation functionality either.
>
> --
> Csaba Nemethi https://www.nemethi.de mailto:csaba....@t-online.de
I disagree.
First of all: The original strings are either english nor german. They more like "meanigfull keys".
Those keys are translated into English, German and so on.
Secondly: Saving indexes of comboboxes is a bad idea, since the number or order of options can change in time.
Thirdly: Making the function available as a standard in the package does not mean that everybody should use it.
If I make an effort programming this funtion, then it might as well be available for the rest of the world. I don't see what harm can it do.

Re: Reversed translation in msgcat

<ygav8c2xnnk.fsf@panther.akutech-local.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12185&group=comp.lang.tcl#12185

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralf...@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: Reversed translation in msgcat
Date: Fri, 22 Sep 2023 16:55:59 +0200
Lines: 20
Message-ID: <ygav8c2xnnk.fsf@panther.akutech-local.de>
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com>
<14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
<uejd1f$2bns$1@dont-email.me>
<d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
<uek7mp$fisq$1@tota-refugium.de>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net 8RCCmGMSONua237co8qUAwgqeBwz79jcQb3Qp7Jw2DYyp5dAY=
Cancel-Lock: sha1:aOXZ3AU8wfEzfzHL/Axri5PPaHM= sha1:5L0rquXIeWnkeHJqaOfbUx7MiSk= sha256:Ad5qkEceskcLs08kvJkwRuHynsMoIrC8RurwpTmzHIU=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 by: Ralf Fassel - Fri, 22 Sep 2023 14:55 UTC

* nemethi <csaba.nemethi@t-online.de>
| Am 22.09.23 um 14:55 schrieb Alexandru:
| > Would id be a good idea to add a new function to msgcat that does the above?
>
| No.
>
| It is correct that the settings should be kept in English only. OTOH,
| I don't see the need for reverse translation, for at least two
| reasons:
--<snip-snip>--
| 2. It is a common case that a translated text corresponds to more than
| one original (English) text. Which one should then be returned by
| the reverse translation? Or can you always guarantee that the
| message catalogue is a one-to-one mapping?

In addition, message catalogue keys can contain %-substitutions, which
make a reverse lookup for those very difficult. A generic reverse
lookup would need to handle these somehow.

R'

Re: Reversed translation in msgcat

<243328df-c7aa-49fb-81d9-48467032f50fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12186&group=comp.lang.tcl#12186

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ad4:4e24:0:b0:656:2660:5c40 with SMTP id dm4-20020ad44e24000000b0065626605c40mr113307qvb.11.1695395064925;
Fri, 22 Sep 2023 08:04:24 -0700 (PDT)
X-Received: by 2002:a05:6871:6a82:b0:1c5:87d6:b779 with SMTP id
zf2-20020a0568716a8200b001c587d6b779mr3234093oab.8.1695395064671; Fri, 22 Sep
2023 08:04:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Fri, 22 Sep 2023 08:04:24 -0700 (PDT)
In-Reply-To: <ygav8c2xnnk.fsf@panther.akutech-local.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:9e8:8934:8200:25ea:af01:ccc2:d93b;
posting-account=glPZ8goAAADztwA3kVEZPMKXCGydx5DU
NNTP-Posting-Host: 2001:9e8:8934:8200:25ea:af01:ccc2:d93b
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com> <14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
<uejd1f$2bns$1@dont-email.me> <d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
<uek7mp$fisq$1@tota-refugium.de> <ygav8c2xnnk.fsf@panther.akutech-local.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <243328df-c7aa-49fb-81d9-48467032f50fn@googlegroups.com>
Subject: Re: Reversed translation in msgcat
From: alexandr...@meshparts.de (Alexandru)
Injection-Date: Fri, 22 Sep 2023 15:04:24 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 22
 by: Alexandru - Fri, 22 Sep 2023 15:04 UTC

Ralf Fassel schrieb am Freitag, 22. September 2023 um 16:56:04 UTC+2:
> * nemethi <csaba....@t-online.de>
> | Am 22.09.23 um 14:55 schrieb Alexandru:
> | > Would id be a good idea to add a new function to msgcat that does the above?
> >
> | No.
> >
> | It is correct that the settings should be kept in English only. OTOH,
> | I don't see the need for reverse translation, for at least two
> | reasons:
> --<snip-snip>--
> | 2. It is a common case that a translated text corresponds to more than
> | one original (English) text. Which one should then be returned by
> | the reverse translation? Or can you always guarantee that the
> | message catalogue is a one-to-one mapping?
> In addition, message catalogue keys can contain %-substitutions, which
> make a reverse lookup for those very difficult. A generic reverse
> lookup would need to handle these somehow.
>
> R'
Agree, only that the programmer can decide to use that function or not.
For example, in my case I know that the keys are unique and there are no %-substititions.

Re: Reversed translation in msgcat

<uekf4q$fn1m$1@tota-refugium.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12187&group=comp.lang.tcl#12187

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.tota-refugium.de!.POSTED!not-for-mail
From: csaba.ne...@t-online.de (nemethi)
Newsgroups: comp.lang.tcl
Subject: Re: Reversed translation in msgcat
Date: Fri, 22 Sep 2023 18:24:58 +0200
Message-ID: <uekf4q$fn1m$1@tota-refugium.de>
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com>
<14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
<uejd1f$2bns$1@dont-email.me>
<d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
<uek7mp$fisq$1@tota-refugium.de>
<aa322a83-d94d-477a-9ef8-50f3514694ben@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 22 Sep 2023 16:24:58 -0000 (UTC)
Injection-Info: tota-refugium.de;
logging-data="515126"; mail-complaints-to="abuse@news.tota-refugium.de"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:1J/Vr/rDqteoWlOKr2Dly6QaLec=
In-Reply-To: <aa322a83-d94d-477a-9ef8-50f3514694ben@googlegroups.com>
X-User-ID: eJwFwQkBwDAIA0BL5QsgZ2XEv4TehUEw6Qh4MKg9M7kqIgkXu2w9xTtBLsZ+7zq7/vWCt/QBHTQRbw==
Content-Language: en-US
 by: nemethi - Fri, 22 Sep 2023 16:24 UTC

Am 22.09.23 um 16:33 schrieb Alexandru:
> nemethi schrieb am Freitag, 22. September 2023 um 16:18:06 UTC+2:
>> Am 22.09.23 um 14:55 schrieb Alexandru:
>>> Harald Oehlmann schrieb am Freitag, 22. September 2023 um 08:43:01 UTC+2:
>>>> Am 22.09.2023 um 08:08 schrieb Alexandru:
>>>>> rene schrieb am Freitag, 22. September 2023 um 07:52:25 UTC+2:
>>>>>> Alexandru schrieb am Donnerstag, 21. September 2023 um 19:51:57 UTC+2:
>>>>>>> Is there a way to reverse the function "mc" in msgcat?
>>>>>>> So to get the original string based on the already translated string.
>>>>>>> The translated string was created applying the "mc" function on the original string.
>>>>>>> Having the result of "mc" can I found out what was the original string?
>>>>>>>
>>>>>>> Many thanks
>>>>>>> Alexandru
>>>>>> AFAIK not directly.But you could intercept the msgcat::mc call like:
>>>>>>
>>>>>> rename ::msgcat::mc ::msgcat::mc1
>>>>>> proc ::msgcat::mc args {
>>>>>> set result [::msgcat::mc1 {*}$args]
>>>>>> # here you have the original $args and the translated string in $result
>>>>>> return $result
>>>>>> }
>>>>> I get it: I would have to save the results of mc to an array or dict.
>>>>> But this is not going to work for me.
>>>>> I'm supprised, that this revesed translation is not aready standard.
>>>>> I need it to save some user settings from the GUI to a file and the restore them from the file to the GUI.
>>>>> Since the GUI values are translated (let's say to German), I don't want to write gernan names to the file.
>>>>> The next user might switch to English so the the saved german words are meaningless.
>>>> Hi Alexandru,
>>>> thank you for the question.
>>>> On the practical side, msgcat maintains a dict.
>>>> You want an access function to the values and get the keys.
>>>> This is doable.
>>>>
>>>> I personally only use Language Tags, e.g.
>>>> mc errFile $err
>>>>
>>>> and
>>>>
>>>> mcflset errFile "File error: %s"
>>>>
>>>> So, this would not help you.
>>>>
>>>> Take care,
>>>> Harald
>>> Thanks Harald.
>>> Would id be a good idea to add a new function to msgcat that does the above?
>> No.
>>
>> It is correct that the settings should be kept in English only. OTOH, I
>> don't see the need for reverse translation, for at least two reasons:
>>
>> 1. If a settings value was selected, e.g., from a combobox, then you
>> should save the combobox index or some other unique identifier rather
>> than the corresponding English text in the settings file. Populating
>> the combobox with language-specific strings should be part of your
>> locale-switching implementation.
>>
>> 2. It is a common case that a translated text corresponds to more than
>> one original (English) text. Which one should then be returned by the
>> reverse translation? Or can you always guarantee that the message
>> catalogue is a one-to-one mapping?
>>
>> GUI toolkits like Gtk or Qt make extensive use of message catalogues.
>> AFAIK, they have no reverse translation functionality either.
>>
>> --
>> Csaba Nemethi https://www.nemethi.de mailto:csaba....@t-online.de
> I disagree.
> First of all: The original strings are either english nor german. They more like "meanigfull keys".
> Those keys are translated into English, German and so on.
> Secondly: Saving indexes of comboboxes is a bad idea, since the number or order of options can change in time.
> Thirdly: Making the function available as a standard in the package does not mean that everybody should use it.
> If I make an effort programming this funtion, then it might as well be available for the rest of the world. I don't see what harm can it do.

I also spoke of "some other unique identifier" as an alternative to
combobox indices. And this seems to be in line with what you call
"meaningful keys".

Implementing a reverse translation functionality would, of course, do no
harm. But this is not what I referred to. Making use of message
catalogues is a wide-spread technique, which works well in practically
all GUI toolkits in spite of the missing reverse translation
functionality. You are free to stick to your idea of using reverse
translation and wait until somebody implements it, or instead to design
your applications in such a way that they don't need any (completely
uncommon) reverse translation. It is your choice.

--
Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de

Re: Reversed translation in msgcat

<5cb879b6-c51a-49ff-9148-b04f37d5ddb0n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12188&group=comp.lang.tcl#12188

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:6214:18f1:b0:64a:5473:41e9 with SMTP id ep17-20020a05621418f100b0064a547341e9mr7981qvb.0.1695441995339;
Fri, 22 Sep 2023 21:06:35 -0700 (PDT)
X-Received: by 2002:a05:6870:5aac:b0:1dc:a981:97c1 with SMTP id
dt44-20020a0568705aac00b001dca98197c1mr524531oab.1.1695441995072; Fri, 22 Sep
2023 21:06:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Fri, 22 Sep 2023 21:06:34 -0700 (PDT)
In-Reply-To: <uekf4q$fn1m$1@tota-refugium.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:9e8:893f:9400:acae:6b72:16e3:40cf;
posting-account=glPZ8goAAADztwA3kVEZPMKXCGydx5DU
NNTP-Posting-Host: 2001:9e8:893f:9400:acae:6b72:16e3:40cf
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com> <14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
<uejd1f$2bns$1@dont-email.me> <d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
<uek7mp$fisq$1@tota-refugium.de> <aa322a83-d94d-477a-9ef8-50f3514694ben@googlegroups.com>
<uekf4q$fn1m$1@tota-refugium.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5cb879b6-c51a-49ff-9148-b04f37d5ddb0n@googlegroups.com>
Subject: Re: Reversed translation in msgcat
From: alexandr...@meshparts.de (Alexandru)
Injection-Date: Sat, 23 Sep 2023 04:06:35 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 6509
 by: Alexandru - Sat, 23 Sep 2023 04:06 UTC

nemethi schrieb am Freitag, 22. September 2023 um 18:25:04 UTC+2:
> Am 22.09.23 um 16:33 schrieb Alexandru:
> > nemethi schrieb am Freitag, 22. September 2023 um 16:18:06 UTC+2:
> >> Am 22.09.23 um 14:55 schrieb Alexandru:
> >>> Harald Oehlmann schrieb am Freitag, 22. September 2023 um 08:43:01 UTC+2:
> >>>> Am 22.09.2023 um 08:08 schrieb Alexandru:
> >>>>> rene schrieb am Freitag, 22. September 2023 um 07:52:25 UTC+2:
> >>>>>> Alexandru schrieb am Donnerstag, 21. September 2023 um 19:51:57 UTC+2:
> >>>>>>> Is there a way to reverse the function "mc" in msgcat?
> >>>>>>> So to get the original string based on the already translated string.
> >>>>>>> The translated string was created applying the "mc" function on the original string.
> >>>>>>> Having the result of "mc" can I found out what was the original string?
> >>>>>>>
> >>>>>>> Many thanks
> >>>>>>> Alexandru
> >>>>>> AFAIK not directly.But you could intercept the msgcat::mc call like:
> >>>>>>
> >>>>>> rename ::msgcat::mc ::msgcat::mc1
> >>>>>> proc ::msgcat::mc args {
> >>>>>> set result [::msgcat::mc1 {*}$args]
> >>>>>> # here you have the original $args and the translated string in $result
> >>>>>> return $result
> >>>>>> }
> >>>>> I get it: I would have to save the results of mc to an array or dict.
> >>>>> But this is not going to work for me.
> >>>>> I'm supprised, that this revesed translation is not aready standard.
> >>>>> I need it to save some user settings from the GUI to a file and the restore them from the file to the GUI.
> >>>>> Since the GUI values are translated (let's say to German), I don't want to write gernan names to the file.
> >>>>> The next user might switch to English so the the saved german words are meaningless.
> >>>> Hi Alexandru,
> >>>> thank you for the question.
> >>>> On the practical side, msgcat maintains a dict.
> >>>> You want an access function to the values and get the keys.
> >>>> This is doable.
> >>>>
> >>>> I personally only use Language Tags, e.g.
> >>>> mc errFile $err
> >>>>
> >>>> and
> >>>>
> >>>> mcflset errFile "File error: %s"
> >>>>
> >>>> So, this would not help you.
> >>>>
> >>>> Take care,
> >>>> Harald
> >>> Thanks Harald.
> >>> Would id be a good idea to add a new function to msgcat that does the above?
> >> No.
> >>
> >> It is correct that the settings should be kept in English only. OTOH, I
> >> don't see the need for reverse translation, for at least two reasons:
> >>
> >> 1. If a settings value was selected, e.g., from a combobox, then you
> >> should save the combobox index or some other unique identifier rather
> >> than the corresponding English text in the settings file. Populating
> >> the combobox with language-specific strings should be part of your
> >> locale-switching implementation.
> >>
> >> 2. It is a common case that a translated text corresponds to more than
> >> one original (English) text. Which one should then be returned by the
> >> reverse translation? Or can you always guarantee that the message
> >> catalogue is a one-to-one mapping?
> >>
> >> GUI toolkits like Gtk or Qt make extensive use of message catalogues.
> >> AFAIK, they have no reverse translation functionality either.
> >>
> >> --
> >> Csaba Nemethi https://www.nemethi.de mailto:csaba....@t-online.de
> > I disagree.
> > First of all: The original strings are either english nor german. They more like "meanigfull keys".
> > Those keys are translated into English, German and so on.
> > Secondly: Saving indexes of comboboxes is a bad idea, since the number or order of options can change in time.
> > Thirdly: Making the function available as a standard in the package does not mean that everybody should use it.
> > If I make an effort programming this funtion, then it might as well be available for the rest of the world. I don't see what harm can it do.
> I also spoke of "some other unique identifier" as an alternative to
> combobox indices. And this seems to be in line with what you call
> "meaningful keys".
>
> Implementing a reverse translation functionality would, of course, do no
> harm. But this is not what I referred to. Making use of message
> catalogues is a wide-spread technique, which works well in practically
> all GUI toolkits in spite of the missing reverse translation
> functionality. You are free to stick to your idea of using reverse
> translation and wait until somebody implements it, or instead to design
> your applications in such a way that they don't need any (completely
> uncommon) reverse translation. It is your choice.
> --
> Csaba Nemethi https://www.nemethi.de mailto:csaba....@t-online.de

I see a third option besides waiting or not doing it: doing it. I was just asking (with focus on the developers of msgcat) if I could write this function as part of the msgcat package. Then it would be available elegantly though the package itself.

Re: Reversed translation in msgcat

<8aa6da63-05a8-4308-ac93-fd84a8039540n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12194&group=comp.lang.tcl#12194

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:1991:b0:774:307c:d3b2 with SMTP id bm17-20020a05620a199100b00774307cd3b2mr16968qkb.0.1695582460068;
Sun, 24 Sep 2023 12:07:40 -0700 (PDT)
X-Received: by 2002:a05:6808:f0b:b0:3ad:fc2e:fbc6 with SMTP id
m11-20020a0568080f0b00b003adfc2efbc6mr2865541oiw.10.1695582459878; Sun, 24
Sep 2023 12:07:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sun, 24 Sep 2023 12:07:39 -0700 (PDT)
In-Reply-To: <5cb879b6-c51a-49ff-9148-b04f37d5ddb0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=109.197.207.112; posting-account=VcikiQoAAAB8qn43rZQzxdhWq0g1FGMy
NNTP-Posting-Host: 109.197.207.112
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com> <14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
<uejd1f$2bns$1@dont-email.me> <d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
<uek7mp$fisq$1@tota-refugium.de> <aa322a83-d94d-477a-9ef8-50f3514694ben@googlegroups.com>
<uekf4q$fn1m$1@tota-refugium.de> <5cb879b6-c51a-49ff-9148-b04f37d5ddb0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8aa6da63-05a8-4308-ac93-fd84a8039540n@googlegroups.com>
Subject: Re: Reversed translation in msgcat
From: aplsim...@gmail.com (Alex P)
Injection-Date: Sun, 24 Sep 2023 19:07:40 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2037
 by: Alex P - Sun, 24 Sep 2023 19:07 UTC

You might put your msgcat stuff in an array, like this

set ar(I) [msgcat::mc {I was chosen}]
set ar(you) [msgcat::mc {you were chosen}]
set ar(we) [msgcat::mc {we were chosen}]
....
and then save not a value, but its "address" (ID, as Csaba said).

I.e. if there was chosen "[msgcat::mc {you were chosen}]", then save "ar(you)" instead it. It's easy to get a value from the array, when the value's address is known. And vice versa.

Make a separate file.tcl for the array of "msgcat::mc"'s, to handle it easier.

Re: Reversed translation in msgcat

<66cc4489-27a3-4de9-a06a-3b243b56006bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12196&group=comp.lang.tcl#12196

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:100d:b0:412:288:8941 with SMTP id d13-20020a05622a100d00b0041202888941mr38307qte.6.1695589383009;
Sun, 24 Sep 2023 14:03:03 -0700 (PDT)
X-Received: by 2002:a05:6808:13cd:b0:3a7:27a:86e3 with SMTP id
d13-20020a05680813cd00b003a7027a86e3mr2967733oiw.3.1695589382748; Sun, 24 Sep
2023 14:03:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sun, 24 Sep 2023 14:03:02 -0700 (PDT)
In-Reply-To: <8aa6da63-05a8-4308-ac93-fd84a8039540n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:9e8:890b:9a00:9863:73db:2a87:5b73;
posting-account=glPZ8goAAADztwA3kVEZPMKXCGydx5DU
NNTP-Posting-Host: 2001:9e8:890b:9a00:9863:73db:2a87:5b73
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com> <14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
<uejd1f$2bns$1@dont-email.me> <d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
<uek7mp$fisq$1@tota-refugium.de> <aa322a83-d94d-477a-9ef8-50f3514694ben@googlegroups.com>
<uekf4q$fn1m$1@tota-refugium.de> <5cb879b6-c51a-49ff-9148-b04f37d5ddb0n@googlegroups.com>
<8aa6da63-05a8-4308-ac93-fd84a8039540n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <66cc4489-27a3-4de9-a06a-3b243b56006bn@googlegroups.com>
Subject: Re: Reversed translation in msgcat
From: alexandr...@meshparts.de (Alexandru)
Injection-Date: Sun, 24 Sep 2023 21:03:03 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2617
 by: Alexandru - Sun, 24 Sep 2023 21:03 UTC

Alex P schrieb am Sonntag, 24. September 2023 um 21:07:42 UTC+2:
> You might put your msgcat stuff in an array, like this
>
> set ar(I) [msgcat::mc {I was chosen}]
> set ar(you) [msgcat::mc {you were chosen}]
> set ar(we) [msgcat::mc {we were chosen}]
> ...
> and then save not a value, but its "address" (ID, as Csaba said).
>
> I.e. if there was chosen "[msgcat::mc {you were chosen}]", then save "ar(you)" instead it. It's easy to get a value from the array, when the value's address is known. And vice versa.
>
> Make a separate file.tcl for the array of "msgcat::mc"'s, to handle it easier.
Thanks. In the mean while I implemented a msgcat extension (2 procs only) to implement the reversed translation (reversed lookup). Thanks to Harald Oehlmann it's already up there on the branch: https://core.tcl-lang.org/tcl/timeline?r=msgcat-reverse-lookup&c=2023-09-24+18%3A30%3A48

Re: Reversed translation in msgcat

<84d77588-8942-48b2-922a-96397c6ae911n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12197&group=comp.lang.tcl#12197

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:6214:3189:b0:647:1ef1:cea4 with SMTP id lb9-20020a056214318900b006471ef1cea4mr41534qvb.6.1695749976624;
Tue, 26 Sep 2023 10:39:36 -0700 (PDT)
X-Received: by 2002:a9d:4c07:0:b0:6c4:e6d4:bc65 with SMTP id
l7-20020a9d4c07000000b006c4e6d4bc65mr978015otf.2.1695749976375; Tue, 26 Sep
2023 10:39:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!border-2.nntp.ord.giganews.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Tue, 26 Sep 2023 10:39:35 -0700 (PDT)
In-Reply-To: <66cc4489-27a3-4de9-a06a-3b243b56006bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=109.197.206.19; posting-account=VcikiQoAAAB8qn43rZQzxdhWq0g1FGMy
NNTP-Posting-Host: 109.197.206.19
References: <cce3de74-4d91-475a-b45a-4ec3b25567f7n@googlegroups.com>
<91c7f56e-29be-4436-9a82-c2ffe7964b36n@googlegroups.com> <14bd951f-856c-4641-b580-51c4d0f43828n@googlegroups.com>
<uejd1f$2bns$1@dont-email.me> <d9b3d63c-9ec4-490a-bfd9-9b0aeebacab6n@googlegroups.com>
<uek7mp$fisq$1@tota-refugium.de> <aa322a83-d94d-477a-9ef8-50f3514694ben@googlegroups.com>
<uekf4q$fn1m$1@tota-refugium.de> <5cb879b6-c51a-49ff-9148-b04f37d5ddb0n@googlegroups.com>
<8aa6da63-05a8-4308-ac93-fd84a8039540n@googlegroups.com> <66cc4489-27a3-4de9-a06a-3b243b56006bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <84d77588-8942-48b2-922a-96397c6ae911n@googlegroups.com>
Subject: Re: Reversed translation in msgcat
From: aplsim...@gmail.com (Alex P)
Injection-Date: Tue, 26 Sep 2023 17:39:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 37
 by: Alex P - Tue, 26 Sep 2023 17:39 UTC

It's important to count a context of usage, which doesn't imply a one-to-one mapping "original-translation", in general.

For example, English words can be translated as nouns or verbs:
[msgcat::mc Name] => Name, Имя etc.
[msgcat::mc Name] => Nennen, Называть etc.

Another distinction is a mode to be used: imperative verb (in most cases) or something else:
[msgcat::mc Name] => Nenne, Назвать etc.
[msgcat::mc Name] => Nennen, Называть etc.

So, the various contexts imply the various translations with msgcat::mc. As for those old examples, we could have

for English users:
set ar(context1,name) [msgcat::mc Name1] ;# => Name
set ar(context2,name) [msgcat::mc Name2] ;# => Name
set ar(context3,name) [msgcat::mc Name3] ;# => Name

for non-English users (here, German, Russian, Ukranian):
set ar(context1,name) [msgcat::mc Name1] ;# => Name, Имя, Ім'я
set ar(context2,name) [msgcat::mc Name2] ;# => Nenne, Назвать, Назвати
set ar(context3,name) [msgcat::mc Name3] ;# => Nennen, Называть, Називати

Rather strange, yes? However, without contexts, some (esp. automated) translations look ugly.

The contexts of usage might be considered in the reversing msgcat::mc function - as well as a context option in args of ::msgcat::mc src-string ?arg arg ...?, now used only to format src-string.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor