bug-gettext
[Top][All Lists]
Advanced

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

Re: Manual section §15.5.4 outdated on whence to procure language bindin


From: Bruno Haible
Subject: Re: Manual section §15.5.4 outdated on whence to procure language bindings?
Date: Mon, 23 Sep 2024 23:24:56 +0200

Hi,

lordzsar1@aol.com wrote:

> in §15.5.4 it is claimed that a C# binding exists that allows calling gettext 
> functions via a class "GettextResourceManager".

Yes [1], and its implementation is contained in the tarball of each GNU gettext
release, in directory gettext-runtime/intl-csharp/ . You can also find its
sources and reference documentation in the git repository [2].

> Alledgedly this class is provided by Mono. As of Mono versions 5.18.0.240 to 
> 6.12.0.200 this does not seem to be the case:
> - My Debian 10, 11, 12 Mono packages do not provide this class.
> - I grep-ped (-FiRn) the Mono repository for 'GettextResourceManager' and it 
> does not contain any such word.

This class is not provided by Mono.

> What library contains the C# class GettextResourceManager? Whence to obtain 
> it? What is its namespace?

It is in the GNU gettext source code distributions.
"namespace GNU.Gettext".

Do you think it would be useful to distribute it through NuGet [3]?

> Many other people seem to be unable to find it:
> 
> - Mono have released no less than two wrappers of their own: 
> Mono.Posix.Catalog and Mono.Unix.Catalog, each of which directly calls into 
> libintl and does not use any GettextResourceManager

From the warnings in [4]
./Unix.cs(17,37): warning CS0618: `Mono.Unix.Error' is obsolete: `Use 
Mono.Unix.Native.Errno'
./CDExport.cs(57,54): warning CS0618: `Mono.Posix.Catalog' is obsolete: `Use 
Mono.Unix.Catalog'

it looks like a large part of the package Mono.Unix / Mono.Posix packages
was refactored at some point. So effectively it's only one implementation.

> PS: What prompted this report is that the Mono wrappers listed above both 
> implement gettext incorrectly in such a way as to make using different 
> domains impossible:
> - The function to load a catalogue file also sets this file as the default 
> domain.
> - None of the functions allows to specify a domain explicitly, as dgettext 
> does, described in §11.2.2, or to switch the default domain without loading a 
> new catalogue, as textdomain does, described in §11.2.1.

Indeed, the source code of Mono.Unix.Catalog [5] looks like a quick
implementation made without thinking. It is not object-oriented,
and is not integrated with the System.Resources and System.Globalization
packages.

> - a third person has released - their own wrapper: gettext-dotnet

Indeed. [6] appears to be a "pure C#" adaptation of GNU gettext and
the relevant tools (with some loss of functionality).

> - Stride 3D have released their own wrapper: Stride.GNU.Gettext

That [7] appears to be a modified version of [6].

And that answers my question above: The package that was uploaded
to nuget.org [8] is apparently based on [7], i.e. a modified version
of the pure-C# adaptation [6] of GNU gettext.

> - I have posted this as a question on Stack Exchange two months ago, with so 
> far zero responses: https://stackoverflow.com/q/78794364

Well, sometimes you have more luck on stackoverflow,
sometimes you have more luck here :)

> I would very much like to use the official GettextResourceManager.

You're welcome!

> That aside, Mono is dying and current .NET runtimes are available
> in Debian 11+, so depending on this particular vendor, even if they
> did provide a GettextResourceManager, does not feel future-proof anymore.

For GNU gettext, it does not make a difference whether the Common Language
Implementation (CLI) is a .NET make-alike (named Mono) or the new .NET [9]
from Microsoft under MIT license. If you notice a difference, please
report it.

Bruno

[1] https://www.gnu.org/software/gettext/manual/html_node/C_0023.html
[2] 
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=tree;f=gettext-runtime/intl-csharp;hb=refs/heads/0.22.x
[3] https://www.nuget.org/
[4] https://bugs.gentoo.org/112575
[5] 
https://github.com/mono/mono/blob/main/mcs/class/Mono.Posix/Mono.Unix/Catalog.cs
[6] https://github.com/arbinada-com/gettext-dotnet
[7] https://github.com/stride3d/gettextnet
[8] https://www.nuget.org/packages/Stride.GNU.Gettext/2.0.0
[9] https://en.wikipedia.org/wiki/.NET






reply via email to

[Prev in Thread] Current Thread [Next in Thread]