Contents |
Internationalisation (or internationalization in some places...), also known with the abbreviation i18N (18 letters between the i and n ;o) 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!
Tricky eh...
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");
switch(numDay){
case 0:
weekDay = "Sunday";
break;
case 1:
weekDay = "Monday";
break;
case 2:
weekDay = "Tuesday";
break;
case 3:
weekDay = "Wednesday";
break;
case 4:
weekDay = "Thursday";
break;
case 5:
weekDay = "Friday";
break;
case 6:
weekDay = "Saturday";
break;
}
return = "Today is:" +newline+ weekDay +newline + nowDate +newline + nowTime + newline+ newline +"Locale:" +newline +isoLang;
}
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 use the comment tab to give feedback on this article
No related wiki articles found