Hi,
When creating MS-Project files, I need to provide currency information.
Notably the following:
#CurrencyDigits -> '2'. #CurrencySymbol -> '€'. #CurrencyCode -> 'EUR'. #CurrencySymbolPosition -> '3'.
Doing Locale current currencyPolicy doesn't give a lot of information.
Do I miss something ?
Regards,
Maarten, _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Maarten:
You make a good point. We of course know the currency symbol and code, but do not surface them currently as instance variables. They appear in the format for printing as modified for currency. The only time I believe we use the code is as a substitute
for the currency symbol where there is no known symbol.
What is the meaning (in your context) of currency digits and currency symbol position?
Once I know the above, I can look into the CLDR and see how it is represented there and what we can do about adding this to 8.0.
Thank you for pointing this out.
Les Kooyman
Cincom Smalltalk Engineering
From: [hidden email] [[hidden email]] on behalf of Maarten MOSTERT [[hidden email]]
Sent: Tuesday, April 15, 2014 5:36 AM To: VWNC Subject: [vwnc] Locale currency Info Hi,
When creating MS-Project files, I need to provide currency information.
Notably the following:
#CurrencyDigits -> '2'. #CurrencySymbol -> '€'. #CurrencyCode -> 'EUR'. #CurrencySymbolPosition -> '3'.
Doing Locale current currencyPolicy doesn't give a lot of information.
Do I miss something ?
Regards,
Maarten, _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
<base href="x-msg://2/">Les,
Thank you for looking into this. Le 15 avr. 2014 à 21:03, "Kooyman, Les" <[hidden email]> a écrit :
Here you go for Microsoft requirements Currency symbol : http://msdn.microsoft.com/en-us/library/bb968575(v=office.12).aspx Currency three letter code: http://msdn.microsoft.com/en-us/library/bb968575(v=office.12).aspx Currency digits : http://msdn.microsoft.com/en-us/library/bb968638(v=office.12).aspx Currency position : http://msdn.microsoft.com/en-us/library/bb968631(v=office.12).aspx Regards, Maarten,
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Thanks for the links.
I will follow up on this. Integrating with MS-Project is "goodness" from my perspective.
Les
P.S. Note that the formats we use for printing currency are derived from the CLDR and may differ from what MS does sometimes. If there's any followup in that regard after I look at the MS links I'll drop a further note in here; but expect Cincom Smalltalk
to take its lead from the CLDR in this area.
From: Maarten Mostert [[hidden email]]
Sent: Wednesday, April 16, 2014 10:26 AM To: Kooyman, Les Cc: VWNC Subject: Re: [vwnc] Locale currency Info Les,
Thank you for looking into this.
Le 15 avr. 2014 à 21:03, "Kooyman, Les" <[hidden email]> a écrit :
Here you go for Microsoft requirements
Currency symbol : http://msdn.microsoft.com/en-us/library/bb968575(v=office.12).aspx
Currency three letter code: http://msdn.microsoft.com/en-us/library/bb968575(v=office.12).aspx
Currency digits : http://msdn.microsoft.com/en-us/library/bb968638(v=office.12).aspx
Currency position : http://msdn.microsoft.com/en-us/library/bb968631(v=office.12).aspx
Regards,
Maarten,
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Maarten Mostert-2
On Windows, an alternative would be to use the Win32 API: GetLocaleInfoEx() http://msdn.microsoft.com/en-us/library/windows/desktop/dd318103%28v=vs.85%29.aspx and query for: LOCALE_ICURRENCY http://msdn.microsoft.com/en-us/library/windows/desktop/dd373755%28v=vs.85%29.aspx LOCALE_SINTLSYMBOL http://msdn.microsoft.com/en-us/library/windows/desktop/dd373847%28v=vs.85%29.aspx LOCALE_ICURRDIGITS http://msdn.microsoft.com/en-us/library/windows/desktop/dd373754%28v=vs.85%29.aspx |
Hi Holger,
Thanks for the tip. Just notice that I basically need this info to be able to work with imports and exports on files made for a currencies different from my local one. So If I import a file with USD I either convert the dollars into Euros or I keep on working with USD in a consistent way by setting my locale to work with dollars. The currency digit thing is obviously more like a preference. If you're used to work in k€ or M$ your not going to specify 2 or 3 digits for your numbers. Regards, Maarten, Le 17 avr. 2014 à 13:06, Holger Kleinsorgen <[hidden email]> a écrit : > Maarten Mostert wrote >> When creating MS-Project files, I need to provide currency information. >> >> Notably the following: >> >> #CurrencyDigits -> '2'. >> #CurrencySymbol -> '€'. >> #CurrencyCode -> 'EUR'. >> #CurrencySymbolPosition -> '3'. > > On Windows, an alternative would be to use the Win32 API: > > GetLocaleInfoEx() > http://msdn.microsoft.com/en-us/library/windows/desktop/dd318103%28v=vs.85%29.aspx > > and query for: > > LOCALE_ICURRENCY > http://msdn.microsoft.com/en-us/library/windows/desktop/dd373755%28v=vs.85%29.aspx > LOCALE_SINTLSYMBOL > http://msdn.microsoft.com/en-us/library/windows/desktop/dd373847%28v=vs.85%29.aspx > LOCALE_ICURRDIGITS > http://msdn.microsoft.com/en-us/library/windows/desktop/dd373754%28v=vs.85%29.aspx > > > > > > > -- > View this message in context: http://forum.world.st/Locale-currency-Info-tp4754753p4755078.html > Sent from the VisualWorks mailing list archive at Nabble.com. > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Kooyman, Les
<base href="x-msg://67/">
Might not be the fastest way but adding the following 3 methods will do the job. #+Maarten, ======//====== From VisualWorks® Personal Use Edition, 7.9.1 of 18 octobre 2012 on 18 avril 2014 at 13:01:34 Core.CompositeLocale methods for 'handy path ms-project' getCurrency ^self getCurrencyFromSymbol: self getCurrencySymbol getCurrencyFromSymbol: aString "All but older turkies Lira is covered according to ISO 4217" | aCol aDic aCurrency | aCol := OrderedCollection new. aCol add: #(76 101 107) -> 'ALL'. aCol add: #(1547) -> 'AFN'. aCol add: #(36) -> 'ARS'. aCol add: #(402) -> 'AWG'. aCol add: #(36) -> 'AUD'. aCol add: #(1084 1072 1085) -> 'AZN'. aCol add: #(36) -> 'BSD'. aCol add: #(36) -> 'BBD'. aCol add: #(112 46) -> 'BYR'. aCol add: #(66 90 36) -> 'BZD'. aCol add: #(36) -> 'BMD'. aCol add: #(36 98) -> 'BOB'. aCol add: #(75 77) -> 'BAM'. aCol add: #(80) -> 'BWP'. aCol add: #(1083 1074) -> 'BGN'. aCol add: #(82 36) -> 'BRL'. aCol add: #(36) -> 'BND'. aCol add: #(6107) -> 'KHR'. aCol add: #(36) -> 'CAD'. aCol add: #(36) -> 'KYD'. aCol add: #(36) -> 'CLP'. aCol add: #(165) -> 'CNY'. aCol add: #(36) -> 'COP'. aCol add: #(8353) -> 'CRC'. aCol add: #(107 110) -> 'HRK'. aCol add: #(8369) -> 'CUP'. aCol add: #(75 269) -> 'CZK'. aCol add: #(107 114) -> 'DKK'. aCol add: #(82 68 36) -> 'DOP'. aCol add: #(36) -> 'XCD'. aCol add: #(163) -> 'EGP'. aCol add: #(36) -> 'SVC'. aCol add: #(107 114) -> 'EEK'. aCol add: #(8364) -> 'EUR'. aCol add: #(163) -> 'FKP'. aCol add: #(36) -> 'FJD'. aCol add: #(162) -> 'GHC'. aCol add: #(163) -> 'GIP'. aCol add: #(81) -> 'GTQ'. aCol add: #(163) -> 'GGP'. aCol add: #(36) -> 'GYD'. aCol add: #(76) -> 'HNL'. aCol add: #(36) -> 'HKD'. aCol add: #(70 116) -> 'HUF'. aCol add: #(107 114) -> 'ISK'. aCol add: #(82 112) -> 'INR'. aCol add: #(82 112) -> 'IDR'. aCol add: #(65020) -> 'IRR'. aCol add: #(163) -> 'IMP'. aCol add: #(8362) -> 'ILS'. aCol add: #(74 36) -> 'JMD'. aCol add: #(165) -> 'JPY'. aCol add: #(163) -> 'JEP'. aCol add: #(1083 1074) -> 'KZT'. aCol add: #(8361) -> 'KPW'. aCol add: #(8361) -> 'KRW'. aCol add: #(1083 1074) -> 'KGS'. aCol add: #(8365) -> 'LAK'. aCol add: #(76 115) -> 'LVL'. aCol add: #(163) -> 'LBP'. aCol add: #(36) -> 'LRD'. aCol add: #(76 116) -> 'LTL'. aCol add: #(1076 1077 1085) -> 'MKD'. aCol add: #(82 77) -> 'MYR'. aCol add: #(8360) -> 'MUR'. aCol add: #(36) -> 'MXN'. aCol add: #(8366) -> 'MNT'. aCol add: #(77 84) -> 'MZN'. aCol add: #(36) -> 'NAD'. aCol add: #(8360) -> 'NPR'. aCol add: #(402) -> 'ANG'. aCol add: #(36) -> 'NZD'. aCol add: #(67 36) -> 'NIO'. aCol add: #(8358) -> 'NGN'. aCol add: #(8361) -> 'KPW'. aCol add: #(107 114) -> 'NOK'. aCol add: #(65020) -> 'OMR'. aCol add: #(8360) -> 'PKR'. aCol add: #(66 47 46) -> 'PAB'. aCol add: #(71 115) -> 'PYG'. aCol add: #(83 47 46) -> 'PEN'. aCol add: #(8369) -> 'PHP'. aCol add: #(122 322) -> 'PLN'. aCol add: #(65020) -> 'QAR'. aCol add: #(108 101 105) -> 'RON'. aCol add: #(1088 1091 1073) -> 'RUB'. aCol add: #(163) -> 'SHP'. aCol add: #(65020) -> 'SAR'. aCol add: #(1044 1080 1085 46) -> 'RSD'. aCol add: #(8360) -> 'SCR'. aCol add: #(36) -> 'SGD'. aCol add: #(36) -> 'SBD'. aCol add: #(83) -> 'SOS'. aCol add: #(82) -> 'ZAR'. aCol add: #(8361) -> 'KRW'. aCol add: #(8360) -> 'LKR'. aCol add: #(107 114) -> 'SEK'. aCol add: #(67 72 70) -> 'CHF'. aCol add: #(36) -> 'SRD'. aCol add: #(163) -> 'SYP'. aCol add: #(78 84 36) -> 'TWD'. aCol add: #(3647) -> 'THB'. aCol add: #(84 84 36) -> 'TTD'. "TRY was abandoned in 2005 and has no symbol' aCol add: #() -> 'TRY'." aCol add: #(8356) -> 'TRL'. aCol add: #(36) -> 'TVD'. aCol add: #(8372) -> 'UAH'. aCol add: #(163) -> 'GBP'. aCol add: #(36) -> 'USD'. aCol add: #(36 85) -> 'UYU'. aCol add: #(1083 1074) -> 'UZS'. aCol add: #(66 115) -> 'VEF'. aCol add: #(8363) -> 'VND'. aCol add: #(65020) -> 'YER'. aCol add: #(90 36) -> 'ZWD'. aDic := Dictionary new. aCol do: [:each | aCurrency := String new: each key size. 1 to: each key size do: [:eachCharc | aCurrency at: eachCharc put: (Character value: (each key at: eachCharc))]. aDic add: aCurrency -> each value]. ^aDic at: aString ifAbsent: [^String new] getCurrencySymbol | aString | aString := (NumberPrintPolicy print: 0 using: self currencyPolicy policy) asString. aString := aString copyWithout: $0. aString := aString copyWithout: self currencyPolicy decimalPoint. aString := aString copyWithout: self currencyPolicy thousandsSeparator. aString := aString copyWithout: Character space. aString := aString copyWithout: (Character codePoint: 160). ^aString Le 16 avr. 2014 à 20:56, "Kooyman, Les" <[hidden email]> a écrit :
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Maarten, you're of course welcome to use whatever you find helpful in your own work, but rather than hardcoding things, I prefer to access them from the CLDR since believe it or
not, currency symbols and codes do change (although not rapidly). That way when they change, we'll pull in fresh information. (This is also the basis for the same information in ICU.)
You can look in the CLDR and see the history of currency changes for a territory - this currency was valid for this date range, then this one, and so forth.
It's actually kind of fascinating in a geopolitical kind of way. :-)
Les
From: Maarten Mostert [[hidden email]]
Sent: Friday, April 18, 2014 4:06 AM To: Kooyman, Les Cc: VWNC Subject: Re: [vwnc] Locale currency Info Might not be the fastest way but adding the following 3 methods will do the job.
#+Maarten,
======//======
From VisualWorks® Personal Use Edition, 7.9.1 of 18 octobre 2012 on 18 avril 2014 at 13:01:34
Core.CompositeLocale methods for 'handy path ms-project'
getCurrency
^self getCurrencyFromSymbol: self getCurrencySymbol
getCurrencyFromSymbol: aString
"All but older turkies Lira is covered according to ISO 4217"
| aCol aDic aCurrency |
aCol := OrderedCollection new.
aCol add: #(76 101 107) -> 'ALL'.
aCol add: #(1547) -> 'AFN'.
aCol add: #(36) -> 'ARS'.
aCol add: #(402) -> 'AWG'.
aCol add: #(36) -> 'AUD'.
aCol add: #(1084 1072 1085) -> 'AZN'.
aCol add: #(36) -> 'BSD'.
aCol add: #(36) -> 'BBD'.
aCol add: #(112 46) -> 'BYR'.
aCol add: #(66 90 36) -> 'BZD'.
aCol add: #(36) -> 'BMD'.
aCol add: #(36 98) -> 'BOB'.
aCol add: #(75 77) -> 'BAM'.
aCol add: #(80) -> 'BWP'.
aCol add: #(1083 1074) -> 'BGN'.
aCol add: #(82 36) -> 'BRL'.
aCol add: #(36) -> 'BND'.
aCol add: #(6107) -> 'KHR'.
aCol add: #(36) -> 'CAD'.
aCol add: #(36) -> 'KYD'.
aCol add: #(36) -> 'CLP'.
aCol add: #(165) -> 'CNY'.
aCol add: #(36) -> 'COP'.
aCol add: #(8353) -> 'CRC'.
aCol add: #(107 110) -> 'HRK'.
aCol add: #(8369) -> 'CUP'.
aCol add: #(75 269) -> 'CZK'.
aCol add: #(107 114) -> 'DKK'.
aCol add: #(82 68 36) -> 'DOP'.
aCol add: #(36) -> 'XCD'.
aCol add: #(163) -> 'EGP'.
aCol add: #(36) -> 'SVC'.
aCol add: #(107 114) -> 'EEK'.
aCol add: #(8364) -> 'EUR'.
aCol add: #(163) -> 'FKP'.
aCol add: #(36) -> 'FJD'.
aCol add: #(162) -> 'GHC'.
aCol add: #(163) -> 'GIP'.
aCol add: #(81) -> 'GTQ'.
aCol add: #(163) -> 'GGP'.
aCol add: #(36) -> 'GYD'.
aCol add: #(76) -> 'HNL'.
aCol add: #(36) -> 'HKD'.
aCol add: #(70 116) -> 'HUF'.
aCol add: #(107 114) -> 'ISK'.
aCol add: #(82 112) -> 'INR'.
aCol add: #(82 112) -> 'IDR'.
aCol add: #(65020) -> 'IRR'.
aCol add: #(163) -> 'IMP'.
aCol add: #(8362) -> 'ILS'.
aCol add: #(74 36) -> 'JMD'.
aCol add: #(165) -> 'JPY'.
aCol add: #(163) -> 'JEP'.
aCol add: #(1083 1074) -> 'KZT'.
aCol add: #(8361) -> 'KPW'.
aCol add: #(8361) -> 'KRW'.
aCol add: #(1083 1074) -> 'KGS'.
aCol add: #(8365) -> 'LAK'.
aCol add: #(76 115) -> 'LVL'.
aCol add: #(163) -> 'LBP'.
aCol add: #(36) -> 'LRD'.
aCol add: #(76 116) -> 'LTL'.
aCol add: #(1076 1077 1085) -> 'MKD'.
aCol add: #(82 77) -> 'MYR'.
aCol add: #(8360) -> 'MUR'.
aCol add: #(36) -> 'MXN'.
aCol add: #(8366) -> 'MNT'.
aCol add: #(77 84) -> 'MZN'.
aCol add: #(36) -> 'NAD'.
aCol add: #(8360) -> 'NPR'.
aCol add: #(402) -> 'ANG'.
aCol add: #(36) -> 'NZD'.
aCol add: #(67 36) -> 'NIO'.
aCol add: #(8358) -> 'NGN'.
aCol add: #(8361) -> 'KPW'.
aCol add: #(107 114) -> 'NOK'.
aCol add: #(65020) -> 'OMR'.
aCol add: #(8360) -> 'PKR'.
aCol add: #(66 47 46) -> 'PAB'.
aCol add: #(71 115) -> 'PYG'.
aCol add: #(83 47 46) -> 'PEN'.
aCol add: #(8369) -> 'PHP'.
aCol add: #(122 322) -> 'PLN'.
aCol add: #(65020) -> 'QAR'.
aCol add: #(108 101 105) -> 'RON'.
aCol add: #(1088 1091 1073) -> 'RUB'.
aCol add: #(163) -> 'SHP'.
aCol add: #(65020) -> 'SAR'.
aCol add: #(1044 1080 1085 46) -> 'RSD'.
aCol add: #(8360) -> 'SCR'.
aCol add: #(36) -> 'SGD'.
aCol add: #(36) -> 'SBD'.
aCol add: #(83) -> 'SOS'.
aCol add: #(82) -> 'ZAR'.
aCol add: #(8361) -> 'KRW'.
aCol add: #(8360) -> 'LKR'.
aCol add: #(107 114) -> 'SEK'.
aCol add: #(67 72 70) -> 'CHF'.
aCol add: #(36) -> 'SRD'.
aCol add: #(163) -> 'SYP'.
aCol add: #(78 84 36) -> 'TWD'.
aCol add: #(3647) -> 'THB'.
aCol add: #(84 84 36) -> 'TTD'.
"TRY was abandoned in 2005 and has no symbol'
aCol add: #() -> 'TRY'."
aCol add: #(8356) -> 'TRL'.
aCol add: #(36) -> 'TVD'.
aCol add: #(8372) -> 'UAH'.
aCol add: #(163) -> 'GBP'.
aCol add: #(36) -> 'USD'.
aCol add: #(36 85) -> 'UYU'.
aCol add: #(1083 1074) -> 'UZS'.
aCol add: #(66 115) -> 'VEF'.
aCol add: #(8363) -> 'VND'.
aCol add: #(65020) -> 'YER'.
aCol add: #(90 36) -> 'ZWD'.
aDic := Dictionary new.
aCol do:
[:each |
aCurrency := String new: each key size.
1 to: each key size
do: [:eachCharc | aCurrency at: eachCharc put: (Character value: (each key at: eachCharc))].
aDic add: aCurrency -> each value].
^aDic at: aString ifAbsent: [^String new]
getCurrencySymbol
| aString |
aString := (NumberPrintPolicy print: 0 using: self currencyPolicy policy)
asString.
aString := aString copyWithout: $0.
aString := aString copyWithout: self currencyPolicy decimalPoint.
aString := aString copyWithout: self currencyPolicy thousandsSeparator.
aString := aString copyWithout: Character space.
aString := aString copyWithout: (Character codePoint: 160).
^aString
Le 16 avr. 2014 à 20:56, "Kooyman, Les" <[hidden email]> a écrit :
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |