×

Discussion Board

Results 1 to 3 of 3

Hybrid View

  1. #1
    Registered User
    Join Date
    Dec 2009
    Location
    Switzerland
    Posts
    121

    Since Anna: Date.toLocalString() is not anymore local

    Hi,
    I have a widget with a calendar. To be compatible with every language in this world, I inserted this function to get the name of the week day:
    date.toLocaleDateString().substr(0,3)

    It works on S^3 and I get the name of the day. Since I installed Anna it doesnt' work anymore.

    If I print out date.toLocaleString() I get the english formatted text: "Thu Aug 25 16:44:53 2011"
    If I print out date.toString() I get also the english formatted text: "Thu Aug 25 2011 16:44:53 GMT +0200 (WILDABBR)
    If I print out date.toLocaleDateString() I get this string: "08/25/2011".

    No chance to get the italian language (phone language is italian).

    Is it a Symbian^Anna bug? Or is there a way to get the string in the local format? I can write an array with 7 items for each language on the world. But this line was definitively more easy

    Thanks, Tiger54
    I discovered Qt in the summer 2010, it was sooo easy and nice to use, that I begun to write some apps.
    Thank you Nokia, for giving me this possibility!

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Since Anna: Date.toLocalString() is not anymore local

    Hi,

    This must be yet another undocumented change from Browser 7.2 to 7.3. Thank you very much for bringing this to our attention.
    I'll take this forward to RnD team.

    Br,
    Ilkka

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    35

    Re: Since Anna: Date.toLocalString() is not anymore local

    You might be interested in a workaround I've used in my widget. You still get a localized date string by reading the StartTime property of a calendar entry. So in order to translate all weekdays to local language, create 7 temporary calendar entries on specific dates which have the desired weekday and extract the weekdays from the StartTime string. After that you can delete the temporary created calendar entries. This needs to be done only once (at least as long as the system language is not changed). The same technique can also be used to localize months. For an optimal solution, you can first check if toLocaleDateString() does return a properly localized string, and if not fall back to the workaround. This works nicely for both Anna and S^3 devices.

Similar Threads

  1. Replies: 5
    Last Post: 2012-02-09, 13:03
  2. Few more broken things since Anna
    By lenclud in forum Symbian
    Replies: 4
    Last Post: 2012-01-06, 22:26
  3. Code does not compile anymore, has been working since the 9210 communicator
    By sevdwal in forum Tools and SDK Feedback (Closed)
    Replies: 4
    Last Post: 2010-09-29, 11:00
  4. Answer to people saying nokia is not interested in symbian anymore.
    By vasant21 in forum News and Announcements
    Replies: 1
    Last Post: 2006-12-21, 06:09
  5. Drawpixels on 7650 doesn't work anymore since firmware update
    By jtranchant in forum Mobile Java General
    Replies: 0
    Last Post: 2003-02-04, 15:09

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×