4 ms·
> Writing code is not that tough in Europe - just use a proper i18n library. That only goes so far - the actual code you write has to use decimal commas. You c
by ars 11y ago
> Writing code is not that tough in Europe - just use a proper i18n library.
That only goes so far - the actual code you write has to use decimal commas. You can't even export, say a list of numbers, and then directly copy that in to your code.
Or for example: Use SQL to print a list of numbers to use for testing queries. If you used i18n, all the numbers would have decimal commas, so you can't combine them with a comma to make a list.
So you have to turn off i18n, print your list, and make sure it's off when you use that list in a subsequent query.
Any European programmers here? Do you simply leave i18n off for all low level tools? And just use it for customer facing code?
- untog 11y agoHuh? That's not the case at all. Numbers are represented the same way as in the US throughout your code, your just put it through an i18n library when presenting it to the user. It's really not as difficult as you're making it out to be.
- ars 11y ago> when presenting it to the user. That's what I mean - sometimes the user is you, i.e. the programmer, and you have to put those number back in the program - but of course you have to convert them first. > It's really not as difficult as you're making it out to be. Not ever having done it, I will take your word for it.
- kpil 11y agoYes. Minor haggles occur when importing numbers into code , but all good tools can export to whatever format. Typically the internal representation is not related to the external format. But yes there are bugs in (American) programs sometimes that forces you to run them in the C locale. Typically they serialise something and fails parsing it back...
- imtringued 11y agoI'm not sure what's so difficult to understand about calling a function like parseInteger(userEnteredNumber, defaultLocale) on user input and then calling something like formatInteger(numberToBeOutputted, defaultLocate) on numbers that will be shown to the users. Programming languages already have a fixed representation for decimal numbers that will be used regardless of the user locale which is generally always with a dot for the decimal seperator and often there are no thousand seperators.
- ars 11y agoIt's more the confusion about seeing two kinds of numbers. If I see: 123,456 Is it a list of two numbers? Or a single number with a decimal?
- Symbiote 11y agoIn American, how do you know it's not 123 thousand etc?
- hawkice 11y agoThe are two ways to distinguish it being one number or two: (1) Context. This helps most of the time. Not the most helpful for computers, or CSV files. (2) Space. 123,456 is one number and 123, 456 are two. Again, not _strictly_ helpful for CSV files, which is why people use e.g. TSV.
- Symbiote 11y agoThen do the same if it's been written the European way... My point was the OP is making mountains out of molehills.