Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Using Locale, date & time Flash Lite

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

Article Metadata
Created: Risalmin (03 Dec 2007)
Last edited: hamishwillee (23 Jul 2013)


Using locale data in Flash Lite

The i18N trap

Localization and/or Internationalisation (i18N ), is a crucial part in user-friendliness. And even if you are developing only in English, you should keep in mind, that at least the date and time formats should be shown to the user the way they are familiar with and understand.

Why? You will ask... Here's an example: You have just created a Flash Lite movie, that advertises a competition that has an ending date. It's now the 7th of March and you have stated, that your competition finishes 5/3/2008. So there's almost two months time, right? Not exactly. Even though for US and other American users see that date as "3rd of th May, most Europeans would read it as 5th of March and the deadline already missed. For someone in Japan or Sweden, who both use a date format similar to 2007/5/3, this would be even more confusing. They first need to find out the author's nationality and then figure out which one of the two possible dates it might be...

You can even crank the confusion up a notch and use the two digit format for the year and beginning zeroes for month and date and end up with a date like 07/03/08. Which one is that!

  1. The 7th of May 2008
  2. The 3rd of July 2008
  3. The 3rd of August 2007

Tricky eh...

Locale is your friend

The thing to do here, is to utilize the fact, that Flash Lite is aware of the locale

of the device it's on and you can simply ask for the appropriate date format to be displayed.

The following code simply reads the current date and assigns it as avalue to a string variable called nowDate.

status = fscommand2("GetLocaleLongDate", "nowDate");

If you need to play around with the time, language or weekday, see the following example. Keep in mind, that the GetDateWeekday fscommand returns a number, that you need to translate into a weekday name in your code.

function getLocaleData(){
status = fscommand2("GetLocaleLongDate", "nowDate");
numDay = fscommand2("GetDateWeekday");
status = fscommand2("GetLocaleTime", "nowTime");
status = fscommand2("GetLanguage", "isoLang");
case 0:
weekDay = "Sunday";
case 1:
weekDay = "Monday";
case 2:
weekDay = "Tuesday";
case 3:
weekDay = "Wednesday";
case 4:
weekDay = "Thursday";
case 5:
weekDay = "Friday";
case 6:
weekDay = "Saturday";
return = "Today is:" +newline+ weekDay +newline + nowDate +newline + nowTime + newline+ newline +"Locale:" +newline +isoLang;

Time is of the essence too

When you have figured out, how to show the date, you have to keep in mind, that the time of the day needs to be localised too. The format used to display the time does not only differ in the usage of 12 or 24 hour clock, but also the separators between the numbers are different.

Your user will recognise the time if you use the following fscommand. The function below assigns the system time of the handset to a string variable LocalTime.

status = fscommand2("GetLocaleTime", "LocalTime");

Please comment

Please use the comment tab to give feedback on this article

This page was last modified on 23 July 2013, at 06:55.
42 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.