Jump to content
GEOSoft

Locale Questions

Recommended Posts

GEOSoft

Since the AutoIt forums have such an international diversity, I think it's as good a place as any to start.

If your computer is not set up to use English formats for currency then I could use some input here.

I've added _Number_FormatAsCurrency() to my number.au3 file which as far as I know works for any locale returning a numeric value formatted as currency in the users currency format.

Now I want to do a _Number_CurrencyToString() function and I need to know how certain values would be written, for example on a cheque (feel free to send me a sample). Here we would write $10.50 as Ten Dollars and Fifty Cents How would the equivalent value be written in other countries? I would really like to give this function an international scope but I'm not sure how to do it. I can make it work for English only at the moment.

I need examples for things like Euros, Pesos etc.

I will also need to know what is shown in your registry for the sCurrency value at

HKEY_CURRENT_USER\Control Panel\International

Or you could just export that whole key and send me a copy and then I'll pick out what may be important by checking it against mine.

I know that this is going to get tricky but I'll have a go at it anyway. If it fails then I'll just put out a Dollars only version.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Kip

€199,95 (It's a comma, not a dot)

But can't you just do a RegRead in your script?

Edited by Kip

Share this post


Link to post
Share on other sites
BrettF

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\International]

"iCountry"="61"

"iCurrDigits"="2"

"iCurrency"="0"

"iDate"="1"

"iDigits"="2"

"iLZero"="1"

"iMeasure"="0"

"iNegCurr"="1"

"iTime"="0"

"iTLZero"="0"

"Locale"="00000C09"

"s1159"="AM"

"s2359"="PM"

"sCountry"="Australia"

"sCurrency"="$"

"sDate"="/"

"sDecimal"="."

"sLanguage"="ENA"

"sList"=","

"sLongDate"="dddd, d MMMM yyyy"

"sShortDate"="d/MM/yyyy"

"sThousand"=","

"sTime"=":"

"sTimeFormat"="h:mm:ss tt"

"iTimePrefix"="0"

"sMonDecimalSep"="."

"sMonThousandSep"=","

"iNegNumber"="1"

"sNativeDigits"="0123456789"

"NumShape"="1"

"iCalendarType"="1"

"iFirstDayOfWeek"="0"

"iFirstWeekOfYear"="0"

"sGrouping"="3;0"

"sMonGrouping"="3;0"

"sPositiveSign"=""

"sNegativeSign"="-"

[HKEY_CURRENT_USER\Control Panel\International\Geo]

"Nation"="12"

Share this post


Link to post
Share on other sites
monoceres

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\International]
"Locale"="0000041d"
"LocaleName"="sv-SE"
"s1159"=""
"s2359"=""
"sCountry"="Sverige"
"sCurrency"="kr"
"sDate"="-"
"sDecimal"=","
"sGrouping"="3;0"
"sLanguage"="SVE"
"sList"=";"
"sLongDate"="'den 'd MMMM yyyy"
"sMonDecimalSep"=","
"sMonGrouping"="3;0"
"sMonThousandSep"="."
"sNativeDigits"="0123456789"
"sNegativeSign"="-"
"sPositiveSign"=""
"sShortDate"="yyyy-MM-dd"
"sThousand"=" "
"sTime"=":"
"sTimeFormat"="HH:mm:ss"
"sYearMonth"="MMMM yyyy"
"iCalendarType"="1"
"iCountry"="46"
"iCurrDigits"="2"
"iCurrency"="3"
"iDate"="2"
"iDigits"="2"
"NumShape"="1"
"iFirstDayOfWeek"="0"
"iFirstWeekOfYear"="2"
"iLZero"="1"
"iMeasure"="0"
"iNegCurr"="8"
"iNegNumber"="1"
"iPaperSize"="9"
"iTime"="1"
"iTimePrefix"="0"
"iTLZero"="1"

[HKEY_CURRENT_USER\Control Panel\International\Geo]
"Nation"="221"


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
GEOSoft

199,95 (It's a comma, not a dot)

But can't you just do a RegRead in your script?

I'm already reading the registry. What I needed was the text version of what you posted. I'm not wide awake yet and I don't have my glasses on but that looks like the Euro symbol. How would 199,95 be written in text?

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
monoceres

Hmm so you mean like:

"100 kronor och 50 öre"


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
GEOSoft

Windows Registry Editor Version 5.00

<snipped>

Thanks @Bert.

That's the standard English file so $ would be as Dollars and I assume you use Cents for the decimal value therefore making what I have usable. It's the (to me) foreign versions that are going to give me trouble. The idea is to create a function which would take a given currency value and convert that to the equivalent text for use in forms, letters @etc.

I'm beginning to think that all I will get is an English version but I'll see how much more input I get.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
GEOSoft

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\International]
"Locale"="0000041d"
"LocaleName"="sv-SE"
"s1159"=""
"s2359"=""
"sCountry"="Sverige"
"sCurrency"="kr"
<snipped>
[HKEY_CURRENT_USER\Control Panel\International\Geo]
"Nation"="221"
Thanks @monoceres. I was hoping to find more info in there but no such luck. Does "kr" mean Krona? And how would you write the text version of a given kr value?

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
monoceres

See my above post.

Edit: And that is of course 100.50 swedish crowns (Öre is like cent).

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
GEOSoft

See my above post.

Thanks. You posted that while I was posting. That's what I mean. I also just realized that this is going to become a bigger pain than I first thought. In your example I'm thinking that I would have to convert the figures 100 to One Hundred and 50 to Fifty and then do a translation or would you not actually write it that way.

example

"<One hundred> kronor och <fifty> öre" with the values inside the <> translated from English. If that were in dollars we would write it out as One hundred dollars and fifty cents.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
monoceres

Thanks. You posted that while I was posting. That's what I mean. I also just realized that this is going to become a bigger pain than I first thought. In your example I'm thinking that I would have to convert the figures 100 to One Hundred and 50 to Fifty and then do a translation or would you not actually write it that way.

example

"<One hundred> kronor och <fifty> öre" with the values inside the <> translated from English. If that were in dollars we would write it out as One hundred dollars and fifty cents.

Ah I see, 100.50 kr is "Hundra kronor och femtio öre" in Sweden, I can write a func that would translate it if you like.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
GEOSoft

Ah I see, 100.50 kr is "Hundra kronor och femtio öre" in Sweden, I can write a func that would translate it if you like.

That would be great!! Much more than I was looking for. I might not be able to achieve for regionalization but with the help of others I should be able to get more than just English.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Siao

Get familiar with GetCurrencyFormat, GetNumberFormat and other API functions.


"be smart, drink your wine"

Share this post


Link to post
Share on other sites
GEOSoft

Get familiar with GetCurrencyFormat, GetNumberFormat and other API functions.

I already have those. It's the text conversion using AutoIt that is going to be tricky. Like I said, it works in English, it's the regionalization that will be the problem for me. Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
GEOSoft

you mean that you want all numbers written in words?

like 1 = een

2= twee ?

It looks like that's what I'm going to need in order to continue. I'm thinking of a multi dim array to hold the values.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
monoceres

Ok here's my Swedish func. It's was a real challenge!

; Converts a number to swedish text
; Author: monoceres
; Example:
$money = "3333333.26"
$temp = StringSplit($money, ".")
MsgBox(0, "Swedish output:", _GetSwedishOutput($temp[1]) & " kronor och " & String($temp[2]) & " öre")
Func _GetSwedishOutput($string)
    Local $groups[1]
    Local $answer
    Local $swe[9] = ["en", "två", "tre", "fyra", "fem", "sex", "sju", "åtta", "nio"]
    Local $special[9] = ["elva", "tolv", "tretton", "fjorton", "femton", "sexton", "sjutton", "arton", "nitton"]
    Local $ten = "tio"
    Local $hundred = "hundra"
    Local $big[4] = ["tusen", "miljoner", "miljarder"]
    Local $temp
    If StringLen($string) <= 3 Then
        $array = StringSplit($string, "")
        For $i = UBound($array) - 1 To 1 Step -1
            $len = UBound($array)
            $num = $array[$i]
            If $num = "0" Then ContinueLoop
            Switch $i
                Case $i = $len - 1
                    $answer = $swe[$num - 1] & $answer
                Case $i = $len - 2
                    If $num = 1 Then
                        If $array[$len - 1] <> 0 Then
                            $answer = $special[$array[$len - 1] - 1]
                            ContinueLoop
                        EndIf
                        $answer = "tio" & $answer
                    ElseIf $num = 2 Then
                        $answer = "tjugo" & $answer
                    ElseIf $num = 4 Then
                        $answer = "fyrtio" & $answer
                    ElseIf $num = 3 Then
                        $answer = "trettio" & $answer
                    ElseIf $num = 7 Then
                        $answer = "sjuttio" & $answer
                    ElseIf $num = 8 Then
                        $answer = "åttio" & $answer
                    ElseIf $num = 9 Then
                        $answer = "nittio" & $answer
                    Else
                        $answer = $swe[$num - 1] & $ten & $answer
                    EndIf
                Case $i = $len - 3
                    If $swe[$num - 1] = "en" Then
                        $answer = "ett" & $hundred & $answer
                        ContinueLoop
                    EndIf
                    $answer = $swe[$num - 1] & $hundred & $answer
            EndSwitch
        Next
        Return $answer
    EndIf
    While StringLen($string) > 0
        ReDim $groups[UBound($groups) + 1]
        $groups[UBound($groups) - 1] = StringRight($string, 3)
        $string = StringTrimRight($string, 3)
    WEnd
    For $a = 1 To UBound($groups) - 1
        If $a = 1 Then
            $answer = _GetSwedishOutput($groups[$a])
        Else
            $temp = _GetSwedishOutput($groups[$a])
            If $temp <> "" Then $answer = $temp & $big[$a - 2] & $answer
        EndIf
    Next
    Return $answer
EndFunc   ;==>_GetSwedishOutput

Hope it will be of use :)

Edit: Fixed minor bug.

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Kip

$DutchLow[0] = "nul"; From 0 to 19.  This is 0, duh
$DutchLow[1] = "een"
$DutchLow[2] = "twee"
$DutchLow[3] = "drie"
$DutchLow[4] = "vier"
$DutchLow[5] = "vijf"
$DutchLow[6] = "zes"
$DutchLow[7] = "zeven"
$DutchLow[8] = "acht"
$DutchLow[9] = "negen"
$DutchLow[10] = "tien"
$DutchLow[11] = "elf"
$DutchLow[12] = "twaalf"
$DutchLow[13] = "dertien"
$DutchLow[14] = "veertien"
$DutchLow[15] = "vijftien"
$DutchLow[16] = "zestien"
$DutchLow[17] = "zeventien"
$DutchLow[18] = "achttien"
$DutchLow[19] = "negentien"; and this is 19

$DutchMid[2] = "twintig"; 20 to 90, this is 20
$DutchMid[3] = "dertig"
$DutchMid[4] = "veertig"
$DutchMid[5] = "vijftig"
$DutchMid[6] = "zestig"
$DutchMid[7] = "zeventig"
$DutchMid[8] = "tachtig"
$DutchMid[9] = "negentig"; 90

$DutchHigh[1] = "honderd"; 1 hundred, but in dutch you don't say the "1", just "hundred"
$DutchHigh[2] = "duizend"; 1 thousand, same story as with hundred
$DutchHigh[3] = "miljoen"; 1 million, " "
$DutchHigh[4] = "miljard"; 1 billion, " "

; "and" = "en"

$OrderMidAndLow = $DutchLow[n] & "en" & $DutchMid[n]; Not first the high number and than the low one, like english.

$OrderHighAndLow = $DutchHigh[n] & " en " & $DutchLow[n]

$OrderHighAndMidAndLow = $DutchHigh[n] & $DutchLow[n] & "en" & $DutchMid[n]

example:

1024 = one thousand and four = "duizend en vier" ; here are spaces

64 = sixty-four = "vierenzestig" ; and here not

8 = eight = "acht"

and if a number is 10,20,30,40,etc , you don't say 'twenty and zero', but just 'twenty'

Edited by Kip

Share this post


Link to post
Share on other sites
GEOSoft

Ok here's my Swedish func. It's was a real challenge!

<Snipped>

Hope it will be of use :)

Edit: Fixed minor bug.

I have no doubt about the challenge factor and thank you ever so much. This is great.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
GEOSoft

$DutchLow[0] = "nul"; From 0 to 19.  This is 0, duh
<snipped>
; "and" = "en"

$OrderMidAndLow = $DutchLow[n] & "en" & $DutchMid[n]; Not first the high number and than the low one, like english.

$OrderHighAndMidAndLow = $DutchHigh[n] & $DutchLow[n] & "en" & $DutchMid[n]
Thank you ever so much Kip and also thanks for the word about orders. I would never have thought of that.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×