Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a DateString calculated in English.

Now I would like to change the output according to localization. I have read that localization is possible for Menu, Messages and Cells. A simple $Language = "French" before calling DateString is ignored.

Since this should be a basic feature for localization, I am wondering if my keywords for Google and SX are just plain wrong? Or is this feature not present?

share|improve this question
    
It uses your operating system's language settings, not $Language. Try to change the regional settings of your OS. This did change the date formatting for me on WIndows –  Szabolcs Mar 19 '13 at 16:06
1  
I actually had a similar problem, which I could work around once known but never got a solution. Here is my question in mathgroup. There were no answers for that question there, as far as I can see and remember... –  Albert Retey Mar 19 '13 at 17:24
    
Actually, my OS regional settings are not English. I only installed Mathematica with English interface to be sure to have the same "wording" when discussing with colleagues. Strange. Every high-level language nowadays has this feature (incl. Java). Thus it is just not implemented in pure MM. Ok, there's still the possibility to make a Java call... –  Frank Mar 19 '13 at 18:38
    
What OS do you have? –  Szabolcs Mar 19 '13 at 19:08
    
Win7 64bit with MM9 –  Frank Mar 19 '13 at 19:59

1 Answer 1

Ok, There seems to be some agreement, that the function is not natively implemented in MM. Thus, I will try to answer my question with a workaround. My answer is based on a java question over at SX

In[1]:= Needs["JLink`"]
        InstallJava[];
        LoadJavaClass["java.text.DateFormat"];
        LoadJavaClass["java.util.Date"];
        LoadJavaClass["java.util.Locale"];
In[2]:= date = JavaNew["java.util.Date"];

In[3]:= df = DateFormat`getDateInstance[DateFormat`LONG, Locale`GERMANY];
        df@format[date]

Out[3]= "19. März 2013"

In[4]:= df = DateFormat`getDateInstance[DateFormat`LONG, Locale`FRANCE];
        df@format[date]
Out[4]= "19 mars 2013"

In[5]:= df = DateFormat`getDateInstance[DateFormat`LONG, Locale`ITALY];
        df@format[date]
Out[5]= "19 marzo 2013"

Maybe someone can come up with a better solution. Since then, I stay with my opinion that this feature is basic and should be implemented in MM before any (ugly) tachometer or so onis added to the UI - At least I don't want a Labview like MM...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.