Formatting with alternate calendars in Flex

This article was originally written in English. Text in other languages was provided by machine translation.

Dates can be formatted in various calendars in the Flex SDK. Let’s explore how it works.

Flex SDK lets you format a given date in “alternate calendars” besides the Gregorian calendar. The industry convention refers all non-Gregorian calendars as alternate calendars. To use an alternate calendar, it requires a little bit of care in your Flex application.

Types of calendars

Before we dive into the alternate calendar usages in the Flex SDK, let’s take a brief look at a couple of calen­dars of the world so that you get familiar with what this calendar talk is about. Please be aware, I can only describe the basic usages of some common alternate calendars. There are complexities behind each of the calendars and I may not be explicitly state them. Investigate fur­ther before you actually use them.

Gregorian calendar

This is the calendar most systems provide as the standard. You probably know this calendar already but here are some of the characteristics: There are always twelve months in a year and each month has 28 to 31 days. The numbers of days in each of the months are fixed (30 or 31 days) except for the second month (February), which includes 28 (non-leap years) or 29 days (leap years). The number of days in a year is fixed (365 or 366 days).

Islamic calendar (Hijri calendar)

Islamic calendar is one of the lunar calendars.  There are always twelve months in a year. Each month has ei­ther 29 or 30 days. Beginning of a month is determined by observing the moon phase (Islamic religious calendar). Because of this nature, it is not very possible to predict the dates with the Islamic religious calendar. For the sake of convenience, there is the variant of the calendar, Islamic civil calendar, which determines the dates through some pure mathematical calculation. Islamic civil calendar may not be accurate for religious events. Number of days in a year is 354 or 355 days. Hence, the Islamic calendar year and the Gregorian calendar year are not synchronized.

Japanese calendar

Japanese calendar is very similar with the Gregorian calendar. The difference is the era part and the year. The Gregorian calendar has been using the same era name for the past 2,000 years (AD; Anno Domini). There is also BC (Before Christ) era but BC years are not by supported by pretty much all calendar apps. On the other hand, Japanese calendar era name changes when there is new emperor. Therefore, every ten to a couple of ten years, there are new eras. *1

*1 Before the 1868, the era name changes were more frequent, an era lasted only as low as two years. But just like the BC in Gregorian, there is not much demand to be able to deal with the older eras in today’s calendar applica­tions.

There are much more types of calendars in the world but I hope you got some ideas how calendars can vary.

How to use the alternate calendars in Flex SDK

Now let’s look at the usage of alternate calendars. How do you use calendar other than the Gregorian in the Flex SDK? The an­swer is to use the locale ID.

The locale ID can optionally contain calendar tag. For example:

Locale ID Meaning
ar-SA Arabic used in Saudi Arabia
ar-SA@calendar=islamic Arabic used in Saudi Arabia. Islamic calendar
en-US@calendar=islamic English used in the U.S. Islamic calendar.

When you need to format a date in an alternate calendar, the calendar tag can be appended to the locale ID. Here is an example:

import spark.formatters.DateTimeFormatter;
private function calendarDemo():void
{
    var d:Date = new Date(2011, 9, 15);
    var dtf:DateTimeFormatter = new DateTimeFormatter();
    dtf.dateStyle = "long";
    dtf.timeStyle = "none";
 
    dtf.setStyle("locale", "en-US");
    trace("(1) " + dtf.format(d));
 
    dtf.setStyle("locale", "ar-SA");
    trace("(2) " + dtf.format(d));
 
    dtf.setStyle("locale", "ja-JP");
    trace("(3) " + dtf.format(d));
 
    dtf.setStyle("locale", "en-US@calendar=islamic");
    trace("(4) " + dtf.format(d));
 
    dtf.setStyle("locale", "ar-SA@calendar=islamic");
    trace("(5) " + dtf.format(d));
 
    dtf.setStyle("locale", "en-US@calendar=japanese");
    trace("(6) " + dtf.format(d));
 
    dtf.setStyle("locale", "ja-JP@calendar=japanese");
    trace("(7) " + dtf.format(d));
}

Here is the result you might get.

Please note that the result may vary depending on the run-time platforms.

Limitations you should be aware of

There are couples of limitations in the current Flash Player and Flex SDK for alternate calendar support.

  1. The Date class can handle only Gregorian dates.
  2. The Spark DateTimeFormatter class can format a Date object but parsing feature (translating a formatted Gregorian or non-Gregorian date string into a Date object) is not available. English Gregorian date string can be parsed through the Date class constructor in some degree.
  3. The availability of alternate calendar support and its behavior is platform dependent. Please check the plat­form if the alternate calendar support is important for your application.

If you would like to know more about alternate calendars, the calendar entries on Wikipedia is a good source.

Posted in English, Technology, Tutorials | Tagged , | 2 Comments

FrameMaker Localization Prerelease program!

This article was originally written in English. Text in other languages was provided by machine translation.

Do you use Adobe® FrameMaker® in any of the following three languages?
•    Japanese
•    French
•    German

If yes then here is a great opportunity for you to contribute and make an impact on improving the overall quality of Localized FrameMaker by being a part of Localized Prerelease Program. Here are the areas you can check:
•    Quality of language used throughout the UI: Do you see any instances where the translation is incorrect or not of high quality?
•    Truncations, overlaps, clippings and other flawed UI geometry: Do you notice that some text is getting truncated, or some buttons are appearing skewed?
•    Character rendition: Are the characters used in your language are displayed incorrectly, or cannot be entered in FrameMaker properly?
•    Cross-product consistency: If you are familiar with other Adobe products, do you see any discrepancy that FrameMaker shows vis-à-vis others?
•    General usability: Anything in general that you did not like about the product in general?

So if you are interested please send an email to Vinay Krishan Sharma at vinayks@adobe.com with following details -
1.    Full Name
2.    Email address
3.    Language interested in (out of Japanese, French and German)
4.    Your Company/Organization name
5.    Job Function/Title
6.    How long (no. of years) have you been using FrameMaker?
7.    What version of FrameMaker are you currently using?

Thanks
Vinay K Sharma | Program Manager (Localization) | Adobe Systems

Posted in English, General announcements | Tagged , , | 1 Comment

Adobe Globalization at MT Summit XIII

This article was originally written in English. Text in other languages was provided by machine translation.

Members of Adobe’s Translation Technology Team are currently getting our visas in order, because we are headed to China later this month!  We will be presenting some of our recent work at the Machine Translation Summit, held September 19-23 in Xiamen, China.

MT Summit is the major conference for the MT industry.  Held every other year, the conference rotates between the Americas, Europe, and Asia.  This year the hosting duties fall to the Asia-Pacific Association for Machine Translation, and the conference is being held on the scenic campus of the Xiamen National Accounting Institute

Adobe is well represented on the conference’s schedule.  On Wednesday, I will be presenting on our strategy for increasing the use of MT within Adobe, and on Thursday, my colleague Jeff Rueppel will present a demo of some tools we have been developing to simplify the use of the Moses open-source MT package.

Furthermore, this summer we have been extremely fortunate to host a summer intern, Yifan He from the Centre for Next-Generation Localisation (CNGL) in Dublin. Yifan appears multiple times on the MT Summit schedule — co-teaching a tutorial and presenting a paper as well as a poster.  We attribute his spectacular showing to a combination of his natural brilliance and Adobe’s nurturing atmosphere.  Great job, Yifan!

If you plan to be at the conference, please come find us!  We are always eager to hear about other people’s experiences with MT, especially in the corporate setting.  See you in Xiamen!

Posted in English, Events | Tagged , , | Leave a comment

Invoking ICU from Adobe AIR Applications

This article was originally written in English. Text in other languages was provided by machine translation.

Adobe Flash and AIR are ubiquitous platforms to develop rich internet applications. Flash is used for browser based applications and AIR is used for developing native platform applications. Both platforms have considerable support for globalization. Globalization enablement features like locale aware formatting/parsing, collation, case transforms, localization and multi-lingual text rendering are supported by both these platforms. But some more globalization features like text normalization, transliteration, Unicode character properties, encoding conversions, charset detections, Unicode string utilities etc are still missing in the Adobe AIR and Flash platforms. One of the primary reasons for not adding all these features inside the Adobe runtime platforms is the size of the software.

To overcome the size limitation issue, Adobe AIR and Flash can invoke the services of external dynamic libraries through ActionScript. There are some well known external libraries which have rich globalization support like ICU, GNU glib, Verisign IDN library to name a few. Fortunately the upcoming Adobe AIR 3.0 (now available as Adobe pre-release) has a wonderful feature called ActionScript native extensions, which is about ActionScript programming interface for a native code library like MS Windows DLL, Os X FrameWork, Android JAR or shared library or iOS static library. Please see Adobe AIR3 beta site http://labs.adobe.com/technologies/flashplatformruntimes/air3/ on how to download and take part in the Adobe AIR pre-release. Please make a note that this native extensions feature is available _only_ in Adobe AIR platform, not in the Flash platform.

In this blog, I demonstrate a sample (Download air_icu ) application to invoke ICU from an Adobe AIR application on Windows platform. Readers are reminded that this is only illustration sample software and by no means production quality software. Hence readers must exhibit discretion in using this software as it is. The sample illustrates ICU word breaking, sentence breaking, utf-conversion and Unicode character property verification.

You will need the following software to build an ICU extension for AIR platform.

1         Building ICU extension for Adobe AIR

Adobe AIR t native extensions, also known as ‘ane’ or ‘ANE’ files are archived packages. These consist of

  • ActionScript wrapper classes calling into external DLLs
  • The external DLLs
  • XML file describing details of external DLLs

The archived ANE files are used just like SWC libraries in integrating into an AIR application. In other words, ANE file is a library and it has public ActionScript APIs.

Covering all details about the ActionScript extension is too much for this blog article, but I will explain the steps to build this sample and run. Below are the sequential steps and commands.

1.1       Building Windows AIR ICU Extension DLL

1)      The AirIcuExtensionWin folder has the Visual studio solution ‘AirIcuExtension.sln’. Open this in MS VS2010.

2)      The file AIRIcuExtension.cpp has the necessary code needed to interface with Adobe AIR 3 beta 2. It also has the wrapper routines calling ICU C functions.

3)      This is a DLL project and the build output is AirIcuExtension.dll

1.2       Building ActionScript Library

1)      Build the actionscript library using the below command.

C:\Flex4.5.1\bin\compc.exe -source-path src -include-classes com.adobe.extensions.AirIcuExtension  -external-library-path C:\air3_beta2\frameworks\libs\air\airglobal.swc -output bin\AirIcuExtension.swc

The file AirIcuExtension.as in the folder src\com\adobe\extensions has the public class AirIcuExtension which calls the ICU routines. In this sample, calling ICU sentence breaker, word breaker, normalizer, utf-conversion and Unicode character property have been illustrated.

1.3       Packaging ActionScript native extension

Open the bin\AirIcuExtension.swc is a zipped archive. Open it using WinRAR or WinZip program and extract the library.swf file in the swc package into the AirIcuExtension/bin folder.

The folder src\resources contains file extension.xml, AirIcuExtension.dll and ICU dlls icudt48.dll, icuuc48.dll, icuio48.dll and icuin48.dll. The file external.xml defines the external library details to AIR runtime.

For simplicity, place the AirIcuExtension.dll, ICU dlls and extension.xml files in AirIcuExtension\bin folder. All these files are packaged into a zipped archive called AiricuExtension.ane using the following command.

C:\air3_beta2\bin\adt -package -storetype pkcs12 -storepass <passwd> –keystore <AIR certificate> -tsa none -target ane AirIcuExtension.ane extension.xml -swc AirIcuExtension.swc -platform Windows-x86 library.swf AirIcuExtension.dll icudt48.dll icuin48.dll icuio48.dll icuuc48.dll

Using Adobe FlashBuilder4.x or  C:\air3_beta2\bin\adt program, one can make an AIR certificate.

The output is an archive file AirIcuExtension.ane in the AirIcuExtension/bin folder.

1.4       Building the Test program AirIcuExtensionTest.mxml

Now that we built and packaged the native extension package AiricuExtension.ane, we are readu to use this and call ICU services in a test program.

The folder AirIcuExtensionTest\src contains the test file AirIcuExtensionTest.mxml. The descriptor file AirIcuExtensionTest-app.xml has  the details of native extension. Using the mxml compiler, AirIcuExtensionTest.swf is built as follows in AirIcuExtensionTest folder.

C:\Flex4.5.1\bin\compc.exe\mxmlc +configname=air -external-library-path ..\AirIcuExtension\bin\AirIcuExtension.ane -output bin-debug\AirIcuExtensionTest.swf — src\AirIcuExtensionTest.mxml

The output swf file AirIcuExtensionTest.swf is placed in the bin-debug folder.

1.5       Building AIR package for executing AirIcuExtensionTest

The final step is to package the above AirIcuExtensionTest .swf and AirIcuExtension.ane files into an AIR executable folder.  Execute the following command

C:\air3_beta2\bin\adt -package -XnoAneValidate -storetype pkcs12 -storepass <passwd> –keystore <AIR certificate> -tsa none -target bundle AirIcuExtensionTest.air AirIcuExtensionTest-app.xml AirIcuExtensionTest.swf -extdir ..\..\AirIcuExtension\bin

The output of the above command is a folder AirIcuExtensionTest.air. Inside the folder, there is AirIcuExtensionTest.exe. You can execute and see the output.

2         Conclusion

The sample illustrated how to invoke ICU from ActionScript. The AIR ICU extension is easy to build using the publicly available Adobe Flex SDK and AIR3 Beta 2 SDKs. It will be much easier to do all this in the future Adobe Flash Builder IDE using GUI. The advantages of this feature are

  • AIR developers looking to develop international applications for desktop or mobile have the full power of ICU at hand. Many Unicode features, encoding conversions, IDN conversion utilities, string processing, transforms and many more international features can be easily coded.
  • The native ICU extension once built can be used any any developer as it is a library.
  • The Actionscript APIs calling ICU can be coded using the same signatures as ICU C++ API. This eliminates the learning curve.
  • Since ICU is in native code, performance is not compromised.
  • Since it is ICU, developers can expect cross-platform behavior in AIR programs.
  • Since the extension is a AIR library, ICU updates can be easily re-packaged in to the ane file.

In the future once AIR3 is released, a full fledged ICU native extension with proper API definitions will be a great globalization project.

Posted in English, Technology, Tutorials | Tagged , , | 19 Comments

CS5.5 trials now available in additional languages

This article was originally written in English. Text in other languages was provided by machine translation.

You may now download Win/Mac trials of CS5.5 in your language:

Enjoy!

 

Posted in English, Product announcements | Tagged , , , , , , | Leave a comment

A lightweight auto-complete ActionScript example with a trie

This article was originally written in English. Text in other languages was provided by machine translation.


Auto-complete functionality is used widely over the internet and mobile apps. A lot of websites and apps try to complete your input as soon as you start typing.  In this post, I would like to introduce a simple ActionScript auto-complete solution by using trie data structure.

A trie is an ordered tree data structure that is used to store an associative array. All the descendants of a node have a common prefix of the string associated with that node, and the root is associated with the empty string. Starting from the root node, you can check if a word exists in the trie easily by following pointers corresponding to the letters in the target word. Trie is a well-known data structure in computer science; you can find the detailed information about trie through Wikipedia.

Here is a simple trie implementation in ActionScript:

/**
* An simple data structure to store and look up words.
* @see http://en.wikipedia.org/wiki/Trie for additional details.
*/

public class Trie {
private var _rootKeys:Array;
public function Trie():void {
_rootKeys=[];
}

/**
* Return a list of words which have the given prefix.
*/

public function get(prefix:String):Array {
var results:Array=[];
var letter:String=prefix.substr(0,1);
var root:TrieNode=_rootKeys[letter];
if (root) {
getWordList(prefix, 1, root, results);
}
return results;
}

/**
* Add a word to the object which can be matched as a prefix.
*/

public function add(word:String):void {
var letter:String=word.substr(0,1);
var root:TrieNode=_rootKeys[letter];


if (!root) {
root=createNode(letter);
_rootKeys[letter]=root;
}
insertWord(word, 1, root);
}


private function traverse(root:TrieNode, results:Array, prefix:String):void {
if(root.children) {
for each( var c:TrieNode in root.children ) {
var node:TrieNode = c as TrieNode;
if( node.word ) {
results.push( prefix + node.value);
}
traverse(node, results, prefix+node.value );
}
}
}


private function getWordList(prefix:String,
position:uint,
root:TrieNode,
results:Array):void {
var letter:String=prefix.substr(position,1);
var child:TrieNode=root.children[letter];
if (!letter || !child) {
return;
}


if ( position<(prefix.length-1) ) {
getWordList(prefix, ++position, child, results);
}else {
if (!child.word) {
traverse( child, results, prefix);
}
}

}


private function insertWord(word:String,
position:uint,
root:TrieNode):void {
var letter:String=word.substr(position,1);
if (position==word.length || !letter) {
return;
}


var child:TrieNode=root.children[letter];
if (! child) {
child=createNode(letter);
root.children[letter]=child;
}


if (position==word.length-1) {
child.word=true;
} else {
insertWord(word, ++position, child);
}
}


private function createNode(letter:String):TrieNode {
return new TrieNode(letter,false);
}
}

Posted in English, Libraries, Technology, Tutorials | Tagged , , | Leave a comment

Format date and time in non-Gregorian calendars

This article was originally written in English. Text in other languages was provided by machine translation.

Although the Gregorian calendar is the most used civil calendar, there are other calendars used in different countries and regions.

Islamic calendar is used in many Islamic countries and it has quite a few variances. Japan uses the imperial calendar which identify the year with an era name(年号, nengō) and a number. Thailand uses a calendar that counts in the Buddhist era.

With flash.globalization package, you can easier format a date in non-Gregorian calendars. See the code below.

Posted in English, Libraries, Technology | Tagged , , , , | Leave a comment

Adobe Story now available on Prerelease Interest Form

This article was originally written in English. Text in other languages was provided by machine translation.

Adobe Story, arguably the most powerful script writing in the world got just better for all it’s international users. At present it is shipped in French, German, Italian and Spanish, besides English.

For the all active Adobe Story user community, we are very happy to announce that you can express your interest to join the Adobe Story Prerelease program. So if you are interested to try out Adobe Story in the above mentioned 4 languages then register your interest at Adobe Prerelease Interest Form.

Please note we don’t guarantee any invites yet and it will depend on how much interests we receive.

Vinay Krishan Sharma
Localization Program Manager

Posted in English, Product announcements | Tagged | Leave a comment

Our blog goes multilingual!

This article was originally written in English. Text in other languages was provided by machine translation.

Today we’re rolling out some really cool multilingual functionality in our blog.

Thanks to a WordPress plug-in from Transposh, we are now able to provide translations in various languages for each of our blog posts, which can be easily selected through a simple language-switching mechanism, which you can find on the right sidebar of this page:


Up until now, we tried to reach many of our international customers by maintaining separate blog sites for each language. With the new functionality, we can now serve content in multiple languages in the same location.

For the moment, these are machine translations, which we all know are rarely perfect. But fortunately it’s also possible for readers to contribute better translations (you need to register with us first):

What I find really appealing with this new functionality is that original posts can be in any language, not just English. For example, we have some posts in Brazilian Portuguese, Spanish, Korean and Chinese. These can now be translated into any other available language, including English.

I have seen very few blogs that are multilingual. Our team is certainly the first one at Adobe to do so. Also, I believe we are one of the first multilingual corporate blogs.

I’m curious to see how this will be received by our community of readers. We’re starting with just a handful of languages. If you want to see it in other languages, let us know.

Try it out and let us know what you think.

Leandro Reis
Sr. Globalization Program Manager

Posted in English, General announcements | Tagged , | Leave a comment

Adobe Wish Form Now Available to International Users

This article was originally written in English. Text in other languages was provided by machine translation.

The wish form hosted at Adobe.com is now available to all our international users. We recently added two new fields for you to specify your ‘Product Language’ and ‘OS Language’ along with other information in this form.

Feel free to submit your bugs and feature requests to Adobe using this form. This form is also localized in Japanese, Korean, Simplified Chinese and Traditional Chinese.

Avinash S. Kotwal
International Program Manager

Posted in English, General announcements | 3 Comments