Environment

Post

Posted
Rating:
#1 (In Topic #1802)
Avatar
Expert
Poly is in the usergroup ‘Expert’

When are the environment variables loaded?

Hello, I have created a small project and translated it.
If I now want to test this translation on my system, I use the console and temporarily change the LANG variable there.
For example:
LANG=de_DE.UTF-8
and then start the Gambas interpreter gbx3.
This works fine, and the German translation of the program is displayed.

However, there is now the option to set the environment under the project properties.
If I set the LANG variable here, it has no effect in the IDE, nor when creating an executable file.
So what is the function of the environment variables that I can set here?

And if I set the default language to German in the options, for example, I don't see any effect either, even though I created this language in the translation.
On the other hand, an other system with the locale set to German displays the correct language.

For me, this is yet another little mystery that once again highlights my lack of knowledge. :lol:

Last edit: by Poly

Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

Poly said

Hello, I have created a small project and translated it.
If I now want to test this translation on my system, I use the console and temporarily change the LANG variable there.
For example:
LANG=de_DE.UTF-8
and then start the Gambas interpreter gbx3.
This works fine, and the German translation of the program is displayed.
1. I suppose your system has English as locale for you having to do above
2. An application will run it in language set in locale, if it has the translations available. So, if you create a distribution package of the application it will show English (I presume you used that as default on your controls) on all systems, except for those having German as language in locale. That is the intended use. The more translations your application has the less it will have to default to English. Simple as that.

Poly said

However, there is now the option to set the environment under the project properties.
If I set the LANG variable here, it has no effect in the IDE, nor when creating an executable file.
So what is the function of the environment variables that I can set here?
No idea, I never messed with languages is this manner in the environment :lol:
Could it be your locale setting simply overrules LANG settings here? I don't know what happens under the hood exactly


Poly said

And if I set the default language to German in the options, for example, I don't see any effect either, even though I created this language in the translation.
On the other hand, an other system with the locale set to German displays the correct language.

For me, this is yet another little mystery that once again highlights my lack of knowledge. :lol:
The default language in the project properties you mean or what?
Here you indicate that you have used German on your controls. So, everything, without even a translation provided is default shown in German. Next you would have to add English translations to see English on systems with locale English

So, your application will ALWAYS show German if no English locale because you indicated German is the default language used on controls. Now if you used English on the controls, but set default to German, you are simply messing it up  ;)
I think you did use English on your controls, since you said you made a German translation. So, the default language you set thereis the default language used during desing that needs NO translation.

I would advise to use English as default language on your controls, like I do, because more people know English. Add German (or Dutch in my case) as translation, so persons on a German system will get German, all others will default to English (hence using no translation).






gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Expert
Poly is in the usergroup ‘Expert’
Thank you for your explanation,
but somehow the meaning of the IDE's functions is still not entirely clear to me.

I am referring to the function
Properties → Environment.
Here I set the environment variable LANG, exactly as I do in Bash .
LANG = de_DE.UTF-8
However, I read in the documentation that only de_DE is read and the rest is ignored.
So I also tried LANG = de_DE

I thought that setting the environment variable was the same as changing the environment variable in the console and then calling the interpreter (gbx3).
That is not the case.
I would have at least expected the variable set in the IDE to be used when creating an executable file or an installation package.
However, this is not the case.
As a result, I am unclear about the significance of this option, i.e., setting environment variables in the IDE.


As you correctly guessed, I use GambOS with a US localization by default.
However, I have also installed the German locale.

My program is written in English/American by default, including the labels on the controls.
However, I have written a German translation of all terms.
I had expected that if I set “German” as the default language under "Properties → Options", the German translation of the program would be displayed when I launched the program.
But that is not the case either.

So, to test my German file under GambOS, I can only do it via the Bash by entering
LANG=de_DE.UTF-8 and then gbr3.

That's OK, after all, I can test my translation that way, but the meaning of this function in the Properties is still completely unclear to me.

It is true that on a Devuan system with German as the default language, I also get the German translation when starting normally. Of course, this makes sense, but then I honestly don't see the benefit of these setting options via the Properties.

P.S.: Maybe this isn't a general Gambas problem after all, but rather fits into the “Beginners' questions” category. If so, please move it.

Thank you very much.
 
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

Poly said

Thank you for your explanation,
but somehow the meaning of the IDE's functions is still not entirely clear to me.

I am referring to the function
Properties → Environment.
Here I set the environment variable LANG, exactly as I do in Bash .
LANG = de_DE.UTF-8
However, I read in the documentation that only de_DE is read and the rest is ignored.
So I also tried LANG = de_DE

I thought that setting the environment variable was the same as changing the environment variable in the console and then calling the interpreter (gbx3).
That is not the case.
I would have at least expected the variable set in the IDE to be used when creating an executable file or an installation package.
However, this is not the case.
As a result, I am unclear about the significance of this option, i.e., setting environment variables in the IDE.
I understood what you where trying to do and kind of expected what you expected.
As I said, I never used environment in any of my applications, so never really looked at it.


Poly said

As you correctly guessed, I use GambOS with a US localization by default.
However, I have also installed the German locale.

My program is written in English/American by default, including the labels on the controls.
….


That was no guess, you gave the right clues :thumbs:

And yes labels and all are English, so you set properties to Default English indicating that is the languages that is used ON the controls, lables etc and thus has NO translation file, since it don't need one. 
You very much misunderstand this, it has NOTHING to do with language shown when run, that is determines by locale ONLY.
For German you have created a translation, so a translation file does exist. This will be ONLY used if the locale of the system it is run on is set to German (meaning all the rest, like system menu's etc will be in German)

When multiple languages the default system language will be used, so not German in your case, as I asume all you menu's and all is English while trying to see your German translation. You understand why that won't work ;)
You can reset that order and then your whole environment is German, the IDE will be in German and your executable should run German without needing the environment set. Understand?





 

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Expert
Poly is in the usergroup ‘Expert’
When multiple languages the default system language will be used, so not German in your case, as I asume all you menu's and all is English while trying to see your German translation. You understand why that won't work <img alt=";)" class="top_vertical_alignment" src="https://gambas.one/themes/default/images/cns_emoticons/wink.png" title="" /><br />
You can reset that order and then your whole environment is German, the IDE will be in German and your executable should run German without needing the environment set. Understand?<br />
I think I'm slowly beginning to understand. Thank you very much. :thumbs:
So I had more of an idealized idea of how it works, but this has not yet been implemented.
OK, that's a pity.  :'(  :lol:
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
And I understand what you are trying to do, you just want to see the result of your translation.
I use a VM with Dutch running for my translations. Just as easy.
But what you do works just as well.

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
You would set Properties to Default German if you used German on the actual controls.
You then would need to provide a English translation to get English on systems with locale English, all other systems would get German as default

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
My advise is to use English on controls, Set English to default (meaning it has NO translation files as it doesn't need replacement on the controls by a translation).
Next do translations in the desired languages, so if no translation for a language available it will default to English (as that is ON the controls and needs NO translation file)

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
Item has a rating of 5 (Liked by gbWilly)
#9
Avatar
Expert
Poly is in the usergroup ‘Expert’

gbWilly said

You would set Properties to Default German if you used German on the actual controls.
You then would need to provide a English translation to get English on systems with locale English, all other systems would get German as default

O.K, jetzt habe ich es komplett verstanden.  :)
Ganz lieben Dank, ich hatte da wirklich komplett falsch gedacht.  
Online now: No Back to the top

Post

Posted
Rating:
#10
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

Poly said

So I had more of an idealized idea of how it works, but this has not yet been implemented.
OK, that's a pity.  :'(  :lol:
There is NO not yet implemented, this is IT
Translation just follows the standards used on Linux. A language will only be shown if:
A. system is set to that language and
B. a translation file is available in that language.

This standard is followed by all applications you see running on a Linux system, not just Gambas.

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#11
Avatar
Expert
Poly is in the usergroup ‘Expert’

gbWilly said

Next do translations in the desired languages, so if no translation for a language available it will default to English (as that is ON the controls and needs NO translation file)
Yes, that makes perfect sense.
Thank you very much for this tip.
I will always do it this way in the future.
Online now: No Back to the top

Post

Posted
Rating:
#12
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

Poly said

gbWilly said

You would set Properties to Default German if you used German on the actual controls.
You then would need to provide a English translation to get English on systems with locale English, all other systems would get German as default

O.K, jetzt habe ich es komplett verstanden.  :)
Ganz lieben Dank, ich hatte da wirklich komplett falsch gedacht.  

I knew if I would turn things around your German mind would understand it better  :o

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#13
Avatar
Expert
Poly is in the usergroup ‘Expert’

gbWilly said

This standard is followed by all applications you see running on a Linux system, not just Gambas.
Now I feel caught out.  :cool:
But well, I've learned something for eternity again.  ;)
Online now: No Back to the top

Post

Posted
Rating:
#14
Avatar
Expert
Poly is in the usergroup ‘Expert’
Sorry for the German in the comment above.
But I just had a lightbulb moment in the brain, so there was no room left for the translation.  :D
Online now: No Back to the top

Post

Posted
Rating:
#15
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

Poly said

gbWilly said

This standard is followed by all applications you see running on a Linux system, not just Gambas.
Now I feel caught out.  :cool:
But well, I've learned something for eternity again.  ;)

You haven't noticed in the guides that there are ways of doing things on Linux I point out in intremezzo's and yellow boxes?
You think Linux would not have a standard of providing itself is many many many languages worldwide?  :thumbs:

I try to point these things out in the guides when they start making sense because you need to use them.
It's the 'under the hood' stuff…

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#16
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
This is what gambas uses as base for translations: https://en.wikipedia.org/wiki/Gettext
 
Gambas IDE depends on GNU gettext for a reason.

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top
1 guest and 0 members have just viewed this.