In the English language definition the decimal point seems to be defined as point (.)
In the German language definition it seems to be defined as comma (,).
I had a look in the file /gallery2/modules/core/po/de.po but I couldn't find it.
So my question: Where to find the definition of the decimal point in the language file? Or where can I change the comma to the point in the German language file?
Posts: 16504
Why? That's the standard for most (all?) of Europe.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 4342
Definitely not *all* of Europe...
Posts: 31
Because in German in Switzerland a decimal point is a point and not a comma.
But my question: Where can I change this definition in Gallery2?
Posts: 16504
Alec,
Do you know if this definition is coming out of one of the Gallery translation files or if it's coming from the system's installed locales?
I found this in modules/core/classes/GalleryUtilities.class
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 4342
Am I having a brain "episode", or was this posted as a G3 question?
G2 doesn't concern itself with decimals. The choice of comma or period at output is a php/locale issue. If what the OP says is true (I have no reason to think it isn't) then the de_CH locale settings should already have the period, but either way it's outside the scope of the G2 code.
Posts: 16504
Not a G3 question, but the locales required to be installed on the OS for translations to even work properly. Like so on Debian:
http://people.debian.org/~schultmc/locales.html
That's what I thought. So perhaps the OP needs to ensure that the correct locales are installed on the system.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 31
Ok - I think I have to tell you the whole story - my question was only a little part of it ;-) And sorry, English is not my native language.
Ok, I have installed Gallery2 and WordPress - both latest versions. The connection between the two applications is done by the WordPress plugin WPG2.
WordPress and Gallery2 are running with the German language files. Everything is running quite well - but I run into following problem.
WordPress supports a widget to display a "tag could" in the sidebar. The font-size of the tags which are displayed differs between 8 and 22 point (you can change this standard settings). The font-size in the HTML-code to display the tags is given as a decimal value - eg. style='font-size: 12.554958496pt;'
This works well when WordPress is running and when the plugin WPG2 is disabled. As soon as I enable the WPG2 plugin the decimal value of the font-size is given with a comma instead of a point, eg.style='font-size: 12,554958496pt; and I found out the browser don't understand font-sizes with a decimal values with commas.
When I leave the plugin WPG2 running - but when I changing the language file in Gallery2 from German to English then the decimal value is given again with a point eg. style='font-size: 12.554958496pt;
After finding all these details I asked how to set the decimal value in the German language file of Gallery2.
Long story - sorry ;-)
Posts: 4342
You'd need to find the code line that outputs the font size in WordPress and stop it from using the locale settings. I'm sure somewhere there a WordPress website with support forum you could ask on.
Posts: 31
I don't think this is the right way.
When WordPress is running stand alone that means without the connection via WPG2 to Gallery2 the font-size value is correct - so it isn't a problem within WordPress.
Posts: 4342
The "problem" (which doesn't sound like a problem in G2) is that G2 is setting your php locale (as it should) and WordPress (apparently) can't cope.
Specifically, machine-readable floating numbers should use the 'F' type specifier (non-locale-aware) in the printf format string, rather than 'f' (locale aware) - I think.
Posts: 31
The other way round:
G2 sets the php locale in a wrong way - it should be a point (.) and not a comma (,). Or - my old question - where can I set the correct locale in the G2 configuration?
Posts: 4342
The point that you're missing is that even if your locale is wrong and using a comma when it should be a period, you're addressing the wrong issue. The output from WP shouldn't be using locale-formatted floats at all because it will fail for anyone who visits your site where the locale correctly uses a comma. That is, it will always fail for anyone outside of German-speaking Switzerland and the UK.
If you disable locales in G2 then you will lose all translations. If you want to force a specific locale go to admin -> language settings, choose the default and untick "check browser settings". But you can't decide within G2 which parts of the locale settings are used and which aren't: G2 uses php, php uses printf, and printf uses locale-aware formatting.
This is really something you should address from within WP.
No. G2 sets the locale that your browser requests, and the webserver's operating system is responsible for the effects.
Posts: 31
One thing I don't understand: Why does G2 has an influence on the output of Wordpress? In most of my pages there is no picture from G2 inserted by WPG2 - but G2 changes on every page of WordPress the decimal point from a period (.) which is defined in the language file of Wordpress to the comma (,). Why does G2 cares on the output for Wordpress?
Posts: 4342
Whenever the GalleryTranslator class is initialised it calls setlocale (see modules/core/classes/GalleryTranslator.class line 309). This applies to all future php output. Including the embedding application, I guess.
You could try changing the parameter in that line from LC_ALL to some of the other valid entries: see
http://php.net/manual/en/function.setlocale.php - but other localised output will break, if you do.
It's not G2 changing anything. Read up on how locales work.
Posts: 31
So it would be a good idea to have a setup of the decimal point definition in the language file itself. WordPress has it for decimal point and thousands separator.
Posts: 4342
It's six years too late to suggest that for G2; I don't know what the developers have decided for G3.
Posts: 31
I really hope that they will do it. I want to set these values myself - it's not to job for the server and its definition to do it.
At the end of this discussion I want to describe my workaround:
I patched a WordPress core file: The font-size values are set now as integer values and not as decimal values - so there is now no decimal period or comma which can be changed by the server or an application.
Posts: 27300
Please file a feature request and localization team will investigate/comment.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 31
Will do it - can you give me a link? Thanks.
Posts: 32509
number formatting is complex enough to consider it a task to be solved by well maintained APIs, instead of trying to emulate the logic in your own application's code. it goes well beyond the question of using a point or a comma as decimal separator. i.e. wp's approach of putting _some_ this data into their locale files is flawed.
in g2, we rely on PHP's built-in number formatting based on setlocale().
in g3, we haven't solved the problem yet. it's very likely that we'll use php 5.3's i18n extension (which uses ICU, the world's leading i18n API for number formatting, string handling, date formatting, sorting, etc.).
as for g2's tag cloud. that sounds like a bug in g2. g2 should ensure that it generates valid HTML / CSS for all locales.
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage