www.digitalmars.com         C & C++   DMDScript  

D - Locales

reply "Sarat Venugopal" <sarat_ng n0spam.huelix.com> writes:
Hi, all,
    Scanning the D language specs, I notice that the locale support is
missing from the core language. Many forerunners of D had the same issues
with the locale support retro-fitted as an after thought and generally quite
complex. Since D seems tackle many similar issues at the language level, I
would like to know the rationale behind leaving this important feature out.

Cheers,
Sarat
Oct 05 2003
next sibling parent reply J C Calvarese <jcc7 cox.net> writes:
Sarat Venugopal wrote:
 Hi, all,
     Scanning the D language specs, I notice that the locale support is
 missing from the core language. Many forerunners of D had the same issues
 with the locale support retro-fitted as an after thought and generally quite
 complex. Since D seems tackle many similar issues at the language level, I
 would like to know the rationale behind leaving this important feature out.
 
 Cheers,
 Sarat
http://www.digitalmars.com/d/version.html Does version() fall short of your needs? I've never done any localization, so I don't know exactly what the limitations of version() would be. Walter tends to be open to suggestions if you make a proposal. I attached an example of how version might be used for localization. It's simplistic, but it compiles. Justin
Oct 06 2003
parent reply "Sarat Venugopal" <sarat_ng n0spam.huelix.com> writes:
Support for locales involves more that just strings - things like formatting
dates, numbers, monetary quantities and so on.

Internationalization and easy localization abilities must be built into any
modern language. I do realize that it is not something most people enjoy
doing.

Cheers,
Sarat

"J C Calvarese" <jcc7 cox.net> wrote in message
news:blsrud$9ql$1 digitaldaemon.com...
 Sarat Venugopal wrote:
 Hi, all,
     Scanning the D language specs, I notice that the locale support is
 missing from the core language. Many forerunners of D had the same
issues
 with the locale support retro-fitted as an after thought and generally
quite
 complex. Since D seems tackle many similar issues at the language level,
I
 would like to know the rationale behind leaving this important feature
out.
 Cheers,
 Sarat
http://www.digitalmars.com/d/version.html Does version() fall short of your needs? I've never done any localization, so I don't know exactly what the limitations of version() would be. Walter tends to be open to suggestions if you make a proposal. I attached an example of how version might be used for localization. It's simplistic, but it compiles. Justin
---------------------------------------------------------------------------- ----
 /*

 locales.d

 Author:  Justin C Calvarese
 Date:    October 6, 2003
 License: Public Domain

 Demonstrates using version() to handle different locales.

 Compile for the English locale:
 dmd locales.d -version=English

 Compile for the German locale:
 dmd locales.d -version=Deutsch

 */

 version(English)
 {
 const char[] salutation = "Hi";
 const char[] negative = "No";
 }

 version(Espanol)
 {
 const char[] salutation = "Hola";
 const char[] negative = "No";
 }

 version(Francais)
 {
 const char[] salutation = "Bonjour";
 const char[] negative = "Non";
 }

 version(Deutsch)
 {
 const char[] salutation = "Hallo";
 const char[] negative = "Nein";
 }


 int main()
 {
 printf("%.*s\n", salutation);
 return 0;
  }
Oct 07 2003
next sibling parent reply Helmut Leitner <leitner hls.via.at> writes:
Sarat Venugopal wrote:
 
 Support for locales involves more that just strings - things like formatting
 dates, numbers, monetary quantities and so on.
 
 Internationalization and easy localization abilities must be built into any
 modern language. I do realize that it is not something most people enjoy
 doing.
I agree with you. I would even add that this localization must be independent from the system configuration and changeable at runtime within the applications. I think that those most affected - are you from India? - should put forward a draft or specification that meets their demand. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Oct 07 2003
parent "Sarat Venugopal" <sarat_ng n0spam.huelix.com> writes:
"Helmut Leitner" <leitner hls.via.at> wrote in message
news:3F82B9CD.AC87585 hls.via.at...

 I would even add that this localization must be independent from the
system
 configuration and changeable at runtime within the applications.
I think this aspect is more of an application level issue, though.
 I think that those most affected - are you from India? - should put
 forward a draft or specification that meets their demand.
I am an Indian, but based in Singapore. The most affected, however, are in China, Japan, Korea, parts of Europe, and South America. The issue is not whether the programmer is affeted; rather the target market for the application. I am involved in (consumer) applications that are localized in as many as 26 languages! I'll have to dig a bit deeper into D before I get involved. Cheers, Sarat
Oct 07 2003
prev sibling parent J C Calvarese <jcc7 cox.net> writes:
Sarat Venugopal wrote:
 Support for locales involves more that just strings - things like formatting
 dates, numbers, monetary quantities and so on.
As far as I can tell these issues can be approached either by using version() and then compiling separate executables (as in the attached date example), or by creating a library with all of the localities and compiling support for all of the localities into the same executable. Is this different than what you were expecting?
 
 Internationalization and easy localization abilities must be built into any
 modern language. I do realize that it is not something most people enjoy
 doing.
Is there a programming language that you think has done it correctly or come close to your preferred method? For example, do you like Java's Locale class (java.util)?
 
 Cheers,
 Sarat
Sincerely, Justin
Oct 07 2003
prev sibling parent "Walter" <walter digitalmars.com> writes:
"Sarat Venugopal" <sarat_ng n0spam.huelix.com> wrote in message
news:blqtr8$5dm$1 digitaldaemon.com...
 Hi, all,
     Scanning the D language specs, I notice that the locale support is
 missing from the core language. Many forerunners of D had the same issues
 with the locale support retro-fitted as an after thought and generally
quite
 complex. Since D seems tackle many similar issues at the language level, I
 would like to know the rationale behind leaving this important feature
out. Locales are important, and are unaddressed at this point by the D library. The D core language itself, however, has pretty good support for unicode source and unicode strings.
Oct 07 2003