PC Review


Reply
Thread Tools Rate Thread

Convert a number to a verbal representation

 
 
Picho
Guest
Posts: n/a
 
      13th Feb 2005
Hi group.

This must have come up a few times before but I found no specific resources
regarding this.

the problem is simple: convert the number 55 to the string "Fifty five"
(obviously with any given number...)

The algorithm is quite simple and I would not have bothered you with such a
simple problem.

alas...

must be with Globalization in mind. specificly, the first problem I have is
converting numbers to hebrew strings and as you know, hebrew is not so
simple since there are differences with male/female etc.

my question is simple: What are the guidlines I should follow for this
component to be scaleable, globalized and well designed?
What kind of data source should I use for this component that will be easly
changed (add cultures translation and grammer rules)? where should I keep
this data source (embedded resource?), How shall I design this so that users
(administrators?) could modify/add/remove culture variations?

any specific thoughts about the design and signatures for the convertion
method will be deeply appriciated (should I use CultureInfo with a specific
culture as a parameter etc)

thanx,

Picho

P.S - maybe this can be done by the framework itself and I missed something?



 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      13th Feb 2005
Picho,

In my opinion, forget to do it with globalization.

I know that it has in 2 languages this exceptions for let say 98 in words
(in English Words)
What is in a lot of languages like English: Ninty eight
In German/Dutch: Eight and ninty
In French/French: Four times twenty and ten eight
Belgian/French like the English

I once saw a link given by Peter Huang about VB6, it is so simple that it
should be made in C# just changing a little bit in my opinion to use the
words.

http://www.vbexplorer.com/VBExplorer/tips/src36.asp

I hope this helps?

Cor


 
Reply With Quote
 
John Timney \(ASP.NET MVP\)
Guest
Posts: n/a
 
      13th Feb 2005
I dont believe there is much to help you, this is cutom work.....not
especially difficult though.

Given the numbers are the same regardless your problem lies in representing
the wording (cant help with the hebrew I'm afraid) in each language and you
could simply use a series of xml files, or nodes in one file, to hold your
lookup tables extracting the relevent values for the methods replacement (ie
4 to four) from a language specific file. The methods and calculations to
replace the numerics therefore would remain the same only the replacement of
the value needs to change.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Picho" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi group.
>
> This must have come up a few times before but I found no specific

resources
> regarding this.
>
> the problem is simple: convert the number 55 to the string "Fifty five"
> (obviously with any given number...)
>
> The algorithm is quite simple and I would not have bothered you with such

a
> simple problem.
>
> alas...
>
> must be with Globalization in mind. specificly, the first problem I have

is
> converting numbers to hebrew strings and as you know, hebrew is not so
> simple since there are differences with male/female etc.
>
> my question is simple: What are the guidlines I should follow for this
> component to be scaleable, globalized and well designed?
> What kind of data source should I use for this component that will be

easly
> changed (add cultures translation and grammer rules)? where should I keep
> this data source (embedded resource?), How shall I design this so that

users
> (administrators?) could modify/add/remove culture variations?
>
> any specific thoughts about the design and signatures for the convertion
> method will be deeply appriciated (should I use CultureInfo with a

specific
> culture as a parameter etc)
>
> thanx,
>
> Picho
>
> P.S - maybe this can be done by the framework itself and I missed

something?
>
>
>



 
Reply With Quote
 
Picho
Guest
Posts: n/a
 
      13th Feb 2005
Thank you Cor and John,

I had no intention to do ALL languages....

I was simply asking about design guidlines that will make it easier on
consumers to add their own language (culture) grammer rules.

thanx again,

Picho

"Picho" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi group.
>
> This must have come up a few times before but I found no specific
> resources regarding this.
>
> the problem is simple: convert the number 55 to the string "Fifty five"
> (obviously with any given number...)
>
> The algorithm is quite simple and I would not have bothered you with such
> a simple problem.
>
> alas...
>
> must be with Globalization in mind. specificly, the first problem I have
> is converting numbers to hebrew strings and as you know, hebrew is not so
> simple since there are differences with male/female etc.
>
> my question is simple: What are the guidlines I should follow for this
> component to be scaleable, globalized and well designed?
> What kind of data source should I use for this component that will be
> easly changed (add cultures translation and grammer rules)? where should I
> keep this data source (embedded resource?), How shall I design this so
> that users (administrators?) could modify/add/remove culture variations?
>
> any specific thoughts about the design and signatures for the convertion
> method will be deeply appriciated (should I use CultureInfo with a
> specific culture as a parameter etc)
>
> thanx,
>
> Picho
>
> P.S - maybe this can be done by the framework itself and I missed
> something?
>
>
>



 
Reply With Quote
 
Sean Hederman
Guest
Posts: n/a
 
      13th Feb 2005
Create a class that will do the conversion, with methods that accept
CultureInfo objects. Then, all someone has to do to add additional language
support is subclass your class. Your stock implementation will support the
cultures you want, and exception out for others.

"Picho" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thank you Cor and John,
>
> I had no intention to do ALL languages....
>
> I was simply asking about design guidlines that will make it easier on
> consumers to add their own language (culture) grammer rules.
>
> thanx again,
>
> Picho
>
> "Picho" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi group.
>>
>> This must have come up a few times before but I found no specific
>> resources regarding this.
>>
>> the problem is simple: convert the number 55 to the string "Fifty five"
>> (obviously with any given number...)
>>
>> The algorithm is quite simple and I would not have bothered you with such
>> a simple problem.
>>
>> alas...
>>
>> must be with Globalization in mind. specificly, the first problem I have
>> is converting numbers to hebrew strings and as you know, hebrew is not so
>> simple since there are differences with male/female etc.
>>
>> my question is simple: What are the guidlines I should follow for this
>> component to be scaleable, globalized and well designed?
>> What kind of data source should I use for this component that will be
>> easly changed (add cultures translation and grammer rules)? where should
>> I keep this data source (embedded resource?), How shall I design this so
>> that users (administrators?) could modify/add/remove culture variations?
>>
>> any specific thoughts about the design and signatures for the convertion
>> method will be deeply appriciated (should I use CultureInfo with a
>> specific culture as a parameter etc)
>>
>> thanx,
>>
>> Picho
>>
>> P.S - maybe this can be done by the framework itself and I missed
>> something?
>>
>>
>>

>
>



 
Reply With Quote
 
Picho
Guest
Posts: n/a
 
      13th Feb 2005
Thanx Sean,

I was thinking more how a non-programmer would be able to extend the culture
definitions. that is an external method other than subclassing.

Picho


"Sean Hederman" <(E-Mail Removed)> wrote in message
news:cuochk$f2$(E-Mail Removed)...
> Create a class that will do the conversion, with methods that accept
> CultureInfo objects. Then, all someone has to do to add additional
> language support is subclass your class. Your stock implementation will
> support the cultures you want, and exception out for others.
>
> "Picho" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Thank you Cor and John,
>>
>> I had no intention to do ALL languages....
>>
>> I was simply asking about design guidlines that will make it easier on
>> consumers to add their own language (culture) grammer rules.
>>
>> thanx again,
>>
>> Picho
>>
>> "Picho" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi group.
>>>
>>> This must have come up a few times before but I found no specific
>>> resources regarding this.
>>>
>>> the problem is simple: convert the number 55 to the string "Fifty five"
>>> (obviously with any given number...)
>>>
>>> The algorithm is quite simple and I would not have bothered you with
>>> such a simple problem.
>>>
>>> alas...
>>>
>>> must be with Globalization in mind. specificly, the first problem I have
>>> is converting numbers to hebrew strings and as you know, hebrew is not
>>> so simple since there are differences with male/female etc.
>>>
>>> my question is simple: What are the guidlines I should follow for this
>>> component to be scaleable, globalized and well designed?
>>> What kind of data source should I use for this component that will be
>>> easly changed (add cultures translation and grammer rules)? where should
>>> I keep this data source (embedded resource?), How shall I design this so
>>> that users (administrators?) could modify/add/remove culture variations?
>>>
>>> any specific thoughts about the design and signatures for the convertion
>>> method will be deeply appriciated (should I use CultureInfo with a
>>> specific culture as a parameter etc)
>>>
>>> thanx,
>>>
>>> Picho
>>>
>>> P.S - maybe this can be done by the framework itself and I missed
>>> something?
>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Sean Hederman
Guest
Posts: n/a
 
      13th Feb 2005
Ouch! That'd be seriously tricky. Given the vast amounts of combinations
available, you'd have to write a fairly complex set of classes and UI's
around this.

"Picho" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanx Sean,
>
> I was thinking more how a non-programmer would be able to extend the
> culture definitions. that is an external method other than subclassing.
>
> Picho
>
>
> "Sean Hederman" <(E-Mail Removed)> wrote in message
> news:cuochk$f2$(E-Mail Removed)...
>> Create a class that will do the conversion, with methods that accept
>> CultureInfo objects. Then, all someone has to do to add additional
>> language support is subclass your class. Your stock implementation will
>> support the cultures you want, and exception out for others.
>>
>> "Picho" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Thank you Cor and John,
>>>
>>> I had no intention to do ALL languages....
>>>
>>> I was simply asking about design guidlines that will make it easier on
>>> consumers to add their own language (culture) grammer rules.
>>>
>>> thanx again,
>>>
>>> Picho
>>>
>>> "Picho" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Hi group.
>>>>
>>>> This must have come up a few times before but I found no specific
>>>> resources regarding this.
>>>>
>>>> the problem is simple: convert the number 55 to the string "Fifty five"
>>>> (obviously with any given number...)
>>>>
>>>> The algorithm is quite simple and I would not have bothered you with
>>>> such a simple problem.
>>>>
>>>> alas...
>>>>
>>>> must be with Globalization in mind. specificly, the first problem I
>>>> have is converting numbers to hebrew strings and as you know, hebrew is
>>>> not so simple since there are differences with male/female etc.
>>>>
>>>> my question is simple: What are the guidlines I should follow for this
>>>> component to be scaleable, globalized and well designed?
>>>> What kind of data source should I use for this component that will be
>>>> easly changed (add cultures translation and grammer rules)? where
>>>> should I keep this data source (embedded resource?), How shall I design
>>>> this so that users (administrators?) could modify/add/remove culture
>>>> variations?
>>>>
>>>> any specific thoughts about the design and signatures for the
>>>> convertion method will be deeply appriciated (should I use CultureInfo
>>>> with a specific culture as a parameter etc)
>>>>
>>>> thanx,
>>>>
>>>> Picho
>>>>
>>>> P.S - maybe this can be done by the framework itself and I missed
>>>> something?
>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert String Representation of Excel Constant to Actual Value jgrob3@hotmail.com Microsoft Excel Programming 5 10th Jul 2007 09:49 AM
Convert string to "best possible" ascii representation Achim Domma Microsoft C# .NET 5 30th Aug 2006 04:55 PM
Convert byte to it's bit representation =?Utf-8?B?QWxleA==?= Microsoft C# .NET 1 26th Mar 2006 11:54 PM
bit representation of a number William Stacey [MVP] Microsoft C# .NET 2 26th May 2004 07:16 PM
Letter/Number Representation sparky3883 Microsoft Excel Programming 6 14th Mar 2004 09:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:09 AM.