# double - forced localization?

**URL:** <https://forum.xojo.com/t/double-forced-localization/24572>\
**Category:** Getting Started\
**Created:** [May 29, 2015, 7:08pm UTC](https://forum.xojo.com/t/double-forced-localization/24572 "2015-05-29T19:08:29Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jens\_Knaack1](https://forum.xojo.com/user_avatar/forum.xojo.com/jens_knaack1/32/188_2.png) [@Jens\_Knaack1](https://forum.xojo.com/u/Jens_Knaack1)\
**Post date:** [May 29, 2015, 7:08pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/1 "2015-05-29T19:08:29Z")

</div>

I have a strange problem with variables of type double. The variables seem to have a comma in the written representation. Also in the Debugger. If I run:

dim d as double  
d = d + 0.1  
break

the debugger shows: “0,1” as common in some countries, but not the point as I am expecting (“0.1”). If I change the value in the debugger I have to use the comma; the decimal point is ignored.

I was looking to the representation of doubles because I have a problem with ARGen. I got an exception because the format given for a double variable was with komma instead of the decimal point.

I use a german system with Windows 8.1 - on my Mac it’s the same.

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [May 29, 2015, 7:11pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/2 "2015-05-29T19:11:53Z")

</div>

Yes, the debugger shows floating point values localized. Stupid. IMO you should file a Feedback request.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [May 29, 2015, 8:17pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/3 "2015-05-29T20:17:01Z")

</div>

> [@190657:@Jens Knaack](#):
>
> the debugger shows: “0,1” as common in some countries

> [@190657:@Jens Knaack](#):
>
> I was looking to the representation of doubles because I have a problem with ARGen.

That sounds like two completely separate issues. As far as the debugger goes, it should show the localized values. ARGen is a different problem. Have you reached out to BKeeney Software?

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [May 29, 2015, 8:23pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/4 "2015-05-29T20:23:57Z")

</div>

> [@190677:@Tim Hare](#):
>
> As far as the debugger goes, it should show the localized values.

The debugger should not show the end user value (=localized), but the internal value (= not localized)  personally I think this is wrong as wrong can be.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [May 29, 2015, 8:31pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/5 "2015-05-29T20:31:22Z")

</div>

To the debugger, you are the end user. So it should definitely be localized.

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [May 29, 2015, 8:41pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/6 "2015-05-29T20:41:27Z")

</div>

> [@190686:@Tim Hare](#):
>
> To the debugger, you are the end user.

So is the source editing in the IDE. So why will this not compile?

```auto
Dim d As Double = 1,234
```

Really, that is as silly as storing localized values in a database. The developer always should see the “raw” value.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [May 29, 2015, 9:01pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/7 "2015-05-29T21:01:37Z")

</div>

Those are two completely different things. Putting localized values in code is like storing localized values in a database. Definitely the wrong thing to do. Displaying values in the debugger is live interaction with an end user. I do see your point about the inconsistency, but I wouldn’t call it blatantly wrong. In any case, file a bug report / feature request.

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [May 29, 2015, 9:04pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/8 "2015-05-29T21:04:53Z")

</div>

Just checked: both XCode and Visual Studio show non-localized doubles in the debugger.

---

<div class="post-metadata">

**Author:** ![Jens\_Knaack1](https://forum.xojo.com/user_avatar/forum.xojo.com/jens_knaack1/32/188_2.png) [@Jens\_Knaack1](https://forum.xojo.com/u/Jens_Knaack1)\
**Post date:** [May 29, 2015, 9:17pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/9 "2015-05-29T21:17:28Z")

</div>

@ Tim Hare

I am still checking why ARGen doesn’t work as I exspect it to work.

The error from ARGen was that the double had a format the database didn’t accept (a number with “,” instead of “.” in a double)… In the debugger the double had a “,”. As I know now that’s an information without any value because the debugger shows the localized values.

Before I contact BKeeney software I will try to solve the problem by myself.

For me the forced localization is a bug because I don’t see the “real” things my program deals with. You can see that my problem why the database refuses the values because of wrong format is hidden by the localized representation. At least my problem is more difficult to solve as if I had a correct representation of the values as “seen” by the program itself.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [May 29, 2015, 10:01pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/10 "2015-05-29T22:01:52Z")

</div>

The “real” value in your case is the value being passed to/from the database. It must be being passed as a string, since a true double value wouldn’t have any formatting at all. So the real value you are concerned with is the value of that string and how it is being created, not the value of the double variable and how it is being displayed.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [May 29, 2015, 10:20pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/11 "2015-05-29T22:20:09Z")

</div>

IMHO the debugger being about code, it should have the same representation as the code editor to avoid possible confusion.

I suspect the Xojo engineers did not notice that discrepancy because they use US English locale, which is the same as code.

Same thing for ARGen.

As Norman would say, localization is a lot of fun 😛

---

<div class="post-metadata">

**Author:** ![Jens\_Knaack1](https://forum.xojo.com/user_avatar/forum.xojo.com/jens_knaack1/32/188_2.png) [@Jens\_Knaack1](https://forum.xojo.com/u/Jens_Knaack1)\
**Post date:** [May 30, 2015, 8:24am UTC](https://forum.xojo.com/t/double-forced-localization/24572/12 "2015-05-30T08:24:56Z")

</div>

The problem is that the string sent to the database contains the value with a komma instead of the decimal point (“42,5” instead of “42.5”) . So the database (postgresql) sends an errormessage.

Not the solution, but a (quick and dirty) workaround:

In BKS\_ActiceRecord.PostgresSQLDatabaseAdapter.BindValues I am checking whether the value is a double and if yes I use a helper variable of type text. So the string sent to the database is (for example) “42.4” instead of “42,5”.

.

```
dim pi as Introspection.PropertyInfo = oField.piFieldProperty
dim v as variant = pi.Value(oRecord)
if v.Type = variant.TypeDouble then 
  dim es as double = v.Doublevalue
  dim help as text
  help = es.ToText
  stmt.Bind(i, help)
else
  
  stmt.Bind(i, v)
end if

```

I don’t know. Is it a problem of xojo because I use a german system (we use 42,5 instead of 42.5) or is it a problem of using a variant (or a combination of the two) or am I too stupid to use avtiverecord?

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [May 30, 2015, 11:58am UTC](https://forum.xojo.com/t/double-forced-localization/24572/13 "2015-05-30T11:58:36Z")

</div>

> [@190770:@Jens Knaack](#):
>
> The problem is that the string sent to the database contains the value with a komma instead of the decimal point (“42,5” instead of “42.5”) . So the database (postgresql) sends an errormessage.

Where is that string coming from ?

At any rate, it is probably just as simple as

```auto
thisGoesToTheDatabase = Replace(StringWithComma,",",".")
```

I do not think the problem is the variant. Most probably it is because in German, as well as French locale, the decimal separator is comma.

---

<div class="post-metadata">

**Author:** ![Jens\_Knaack1](https://forum.xojo.com/user_avatar/forum.xojo.com/jens_knaack1/32/188_2.png) [@Jens\_Knaack1](https://forum.xojo.com/u/Jens_Knaack1)\
**Post date:** [May 30, 2015, 12:41pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/14 "2015-05-30T12:41:20Z")

</div>

@Michel Bujardet

Where is that string coming from?

The original code - used for sql-binding - is:

`dim pi as Introspection.PropertyInfo = oField.piFieldProperty
 dim v as variant = pi.Value(oRecord)
stmt.Bind(i, v)
 end if
`

It could be done with string.replace. Perhaps the way with text is a litte bit more localization-independent? I don’t know.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [May 30, 2015, 5:47pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/15 "2015-05-30T17:47:53Z")

</div>

Ah. It’s a problem with Variant. I think your solution of going through an explicit Double-to-String conversion is the right way to go. You might use String and Str() instead of Text and ToText. Make sure you report it to BKeeney.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:46pm UTC](https://forum.xojo.com/t/double-forced-localization/24572/16 "2020-10-29T17:46:33Z")

</div>


