Parsing of .material script
-
- Gnoblar
- Posts: 21
- Joined: Thu May 21, 2009 10:37 am
Re: Parsing of .material script
Let's do this env variables share on private messages, no need to show them on this post (for the moment)
- sparkprime
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
- Contact:
Re: Parsing of .material script
what I do is to set LANG=en_GB.UTF-8
You can run the cmdline program 'locale' to see the current state of things.
LC_ALL takes priority over LC_NUMERIC which takes priority over LANG. So if you had LC_ALL or LC_NUMERIC defined already then LANG wouldn't change the handling of decimal points.
It's also possible that you didn't use a capital 'C' .
If you want to leave everything else in your native locale, you can just export LC_NUMERIC instead of LC_ALL or LANG.
But yes, in the long term, OGRE should parse materials in a local-independent manner. I think what sinbad suggested is the right thing to do. You could even have the user put the intended locale in the material script if you wanted to be overly supportive
You can run the cmdline program 'locale' to see the current state of things.
LC_ALL takes priority over LC_NUMERIC which takes priority over LANG. So if you had LC_ALL or LC_NUMERIC defined already then LANG wouldn't change the handling of decimal points.
It's also possible that you didn't use a capital 'C' .
If you want to leave everything else in your native locale, you can just export LC_NUMERIC instead of LC_ALL or LANG.
But yes, in the long term, OGRE should parse materials in a local-independent manner. I think what sinbad suggested is the right thing to do. You could even have the user put the intended locale in the material script if you wanted to be overly supportive
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
Re: Parsing of .material script
No, a dedicated function would be unnecessary code duplication. Parsing a number from a script or from anywhere else is the same, the only possible variant is whether to be locale-specific or not, which my proposed solution addresses without requiring a new method. The only issue is that it since StringConverter is stateless it becomes awkward to use. I may just make StringConverter instantiable (and therefore thread-local) so that a locale can be set persistently for a series of conversions.jblecanard wrote:You're absolutely right, and my opinion is that parsers should use a dedicated function, because parsing a file is a lot more complex (in theory)
This isn't a hard change, it's just a fairly extensive one. I'll log it for now.
-
- Gnoblar
- Posts: 21
- Joined: Thu May 21, 2009 10:37 am
Re: Parsing of .material script
sinbad wrote:No, a dedicated function would be unnecessary code duplication. Parsing a number from a script or from anywhere else is the same, the only possible variant is whether to be locale-specific or not, which my proposed solution addresses without requiring a new method. The only issue is that it since StringConverter is stateless it becomes awkward to use. I may just make StringConverter instantiable (and therefore thread-local) so that a locale can be set persistently for a series of conversions.jblecanard wrote:You're absolutely right, and my opinion is that parsers should use a dedicated function, because parsing a file is a lot more complex (in theory)
I agree with you. What I meant is in fact what you suggested. I'll try sparkprime suggestions about LC_* env variables.
-
- Gnoblar
- Posts: 21
- Joined: Thu May 21, 2009 10:37 am
Re: Parsing of .material script
Re
I found the right configurations for making things allright. By using this environment values :
LC_NUMERIC=C
LC_LOCAL=C
LC_MESSAGES=fr_FR.UTF-8
LC_COLLATE=C
LANGUAGE=fr_FR.UTF-8
An by making sure the "LC_ALL" variable is not set, everything is ok. The internationalization is ok and the .material scripts are parsed with a dot. May I add a note about this issue in the wiki ?
I found the right configurations for making things allright. By using this environment values :
LC_NUMERIC=C
LC_LOCAL=C
LC_MESSAGES=fr_FR.UTF-8
LC_COLLATE=C
LANGUAGE=fr_FR.UTF-8
An by making sure the "LC_ALL" variable is not set, everything is ok. The internationalization is ok and the .material scripts are parsed with a dot. May I add a note about this issue in the wiki ?
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
Re: Parsing of .material script
Absolutely, practical tips like this are exactly what it's for Thanks.
-
- Gnoblar
- Posts: 21
- Joined: Thu May 21, 2009 10:37 am
Re: Parsing of .material script
I added an entry right here. Hope I've done this well.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Parsing of .material script
Trés bien! To the point. Thanks.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Gnoblar
- Posts: 8
- Joined: Mon Jul 21, 2014 12:18 pm
Re: Parsing of .material script
Hello everybody,
Although this topic was opened a long time ago, I want to add my experience on that :
Using Ogre 1.9.0, the material script are still parsed with some locales issues on Linux. I'm on Ubuntu 14.04, with standard installation fr_FR, the parsing is done with comma instead of dots.
So to help french people in this case you just have to change the LC_NUMERIC by editing the file /usr/share/i18n/locales/fr_FR. Basically, you just have to change the decimal_point from "<U002C>" to "<U002E>". After saving the file, type sudo dpkg-reconfigure locales and all should work great (i.e. script parsed with dot).
Although this topic was opened a long time ago, I want to add my experience on that :
Using Ogre 1.9.0, the material script are still parsed with some locales issues on Linux. I'm on Ubuntu 14.04, with standard installation fr_FR, the parsing is done with comma instead of dots.
So to help french people in this case you just have to change the LC_NUMERIC by editing the file /usr/share/i18n/locales/fr_FR. Basically, you just have to change the decimal_point from "<U002C>" to "<U002E>". After saving the file, type sudo dpkg-reconfigure locales and all should work great (i.e. script parsed with dot).