[Gambas-user] Project language is always en_US

Benoit Minisini benoit.minisini at gambas-basic.org
Sat Oct 8 20:03:00 CEST 2022


Le 07/10/2022 à 17:39, Martin a écrit :
> El 7/10/22 a las 11:39, bb escribió:
>> I had to resort to setting
>> all the LC variables known on this planet (and others) to make it aware
>> that I was in AU and NOT USA!
> 
> what is G*dAwf&l?
> 
> Are you talking about having to change the Linux desktop configuration? 
> If so, which one exactly?
> You know you can use the locale command right?
> 
> in the gambas code, searching with grep where the word en_US exists I 
> found that the file gbx_local.c has a function that searches in the 
> local configuration for the system language but as it does not find it, 
> it puts en_US.
> 
> In my case that I use a GTK desktop (Manjaro XFCE) the locale command 
> does not return parameter in the ALL= key (which is what gbx_local.c 
> looks for).
> Maybe changing a little bit this C function can correct the issue.
> 
> const char *LOCAL_get_lang(void)
> {
>      char *lang;
> 
>      if (!_lang)
>      {
>          lang = getenv("LC_ALL"); */Here maybe use lang = getenv("LANG")/*
>          if (!lang)
>              lang = getenv("LANG");
>          if (!lang || !*lang)
>              lang = "en_US";
>          _lang = STRING_new_zero(lang);
>      }
> 
>      return _lang;
> }
> 

Which version of Gambas do you use? This code is more than two years 
old, now it is:

const char *LOCAL_get_lang(void)
{
	char *lang;

	if (!_lang)
	{
		lang = getenv("LC_ALL");
		if (!lang || !*lang)
			lang = getenv("LANG");
		if (!lang || !*lang)
			lang = "C";
		_lang = STRING_new_zero(lang);
	}

	return _lang;
}

-- 
Benoît Minisini.



More information about the User mailing list