Skip Headers
Oracle® Fusion Applications Developer's Guide
11g Release 1 (11.1.1.5)

Part Number E15524-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

20 Working with Localization Formatting

This chapter describes the Oracle Fusion Applications standards and guidelines for working with localization formatting.

20.1 Introduction to Localization Formatting

When developing applications for international users, it is often necessary to format the display of certain location-dependent data. In the context of Oracle JDeveloper and Oracle Application Development Framework, localization requires implementing formatting patterns so as to properly display the data according to local standards.

Currency, dates, numbers and time zones are localized using Oracle ADF Faces components that bind to the attribute to be localized. In some cases, Groovy or Expression Language methods are used to localize a particular UI component.

20.2 Formatting Currency

Currency values may be formatted differently, depending on the currency code associated with the value. Each currency code is associated with formatting such as precision, currency symbols, and so on.

You can format currency using the default formatting behavior, or by overriding the default formatting. Alternatively, you can format currency on the fly using partial page rendering.

20.2.1 How to Format Currency Using Default Formatting Behavior

To format currency, you must first set the view object custom attribute to type currency and then select the currency code to be used in formatting the currency field. You can specify the currency code by entering its value explicitly, or by writing a Groovy expression in the transient attribute.

Before you begin:

Create an entity object and a view object.

To format currency using default formatting behavior:

  1. In the Projects pane, select the view object.

  2. In the Overview editor, click the Attributes tab, and select the attribute whose values you want to display as currency.

  3. In the Property Inspector, select the Applications tab.

  4. From the Currency Type dropdown list, select True to enable the attribute values to display as currency.

    A transient attribute called AttributeNameCurrencyCode automatically displays, where AttributeName is the name of the attribute you wish to display as currency.

  5. Use an expression to identify the currency code in the transient attribute.

    Currency codes are stored in the FND_Currencies table found in the Oracle Fusion Middleware Extensions for Applications (Applications Core) schema. The currency code determines the format mask for the currency field, including:

    • Precision—Determines the use and number of decimal digits, comma placement, and so on.

    • Currency symbol—Displays the standard symbol for the currency.

    The Expression Language function fnd:currencyPattern() determines formatting for the currency field using the default precision associated with the currency code. No currency symbol or code is displayed in the user interface.

    For example, if the view object includes an attribute called currencyCode, you could use the expression shown in Example 20-1 to identify the currency code.

    Example 20-1 Expression that Identifies the Currency Code

    object.currencyCode
    

    Note:

    For more information about writing Groovy expressions, see the following link:

    http://groovy.codehaus.org/

  6. To display currency values in a user interface, drag and drop the view object including the currency attribute onto the Java Server Faces (JSF) page.

    Note:

    In any user interface (UI) component associated with currency, locate the convertNumber element in Source view. Manually remove the attribute type=currency and save the file. This allows supporting non-ISO standard currencies.

20.2.2 How to Format Currency and Override the Default Formatting Behavior

You can change the default currency formatting behavior by editing the bindings and implementing a different Expression Language method from the one used in Section 20.2.1, "How to Format Currency Using Default Formatting Behavior."

To format currency, overriding the default formatting behavior:

  1. Follow the procedure described in Section 20.2.1, "How to Format Currency Using Default Formatting Behavior" up to step 5.

  2. To display currency symbols and override the default currency code precision, use the fnd:currencyPatternWithPrecisionAndSymbol() Expression Language method as shown in Example 20-2.

    Example 20-2 Bindings to the Number Converter with Specified Precision and Symbol Display

    <af:outputText label="Amount" value="#{bindingToOrderTotal}"> 
    <af:convertNumber pattern="#{fnd:currencyPatternWithPrecisionAndSymbol( 
      bindingToAmountCurrencyCode, bindingToAttrNamePrecision, 
      bindingToAttrNameCurrencySymbol)}" /> 
    <af:outputText>
    

    The currencySymbol parameter can take the values symbol, code, or none.

    Note:

    The type and currency code are not specified as the formatting pattern is generated by the Oracle FND function, and not by Oracle ADF Faces.

    The Expression Language method fnd:currencyPatternWithPrecisionAndSymbol() is to be used to return the currency code, currency symbol, and precision values for the value of the attribute.

    For more information on the currencyPatternWithPrecisionAndSymbol method, see the Javadoc for the oracle.apps.fnd.applcore.common.Preferences class.

  3. To display currency values in a user interface, drag and drop the view object including the currency attribute onto the JSF page.

20.2.3 How to Immediately Format Currency Using Partial Page Rendering

Partial page rendering (PPR) can be used to immediately format or validate a currency-based UI component on the client.

To immediately format currency using partial page rendering:

  • For the UI component with a currency type value, do the following:

    1. Set the autoSubmit attribute to true.

    2. Set the partialTriggers attribute to the ID of the current UI component, as shown in Example 20-3.

    Example 20-3 Formatting Currency Using Partial Page Rendering

    <af:inputText label="fld1" id="fld1" value="#{simplebean.fld1}"
                  autoSubmit="true" partialTriggers="fld1">
      <af:convertNumber pattern="#,#00.00"/>
    </af:inputText> 
    

20.2.4 What Happens When You Format Currency

When formatting currency, Applications Core automatically generates a transient view object attribute with the name attributeNameCurrencyCode. This transient attribute identifies the currency code to be used when formatting the currency field.

When dragging and dropping the view object onto a JSF page, Applications Core generates relevant bindings to the Oracle ADF Faces Number Converter attached to the user interface component as shown in Example 20-4.

Example 20-4 Bindings to the Number Converter

<af:outputText label="Amount" value="#{bindingToOrderTotal}">
<af:convertNumber type="currency"
 currencyCode="#{bindingToAmountCurrencyCode}"
 pattern="#{fnd:currencyPattern(bindingToAmountCurrencyCode)}" />
<af:outputText>

The bindings indicate that the Expression Language method fnd:currencyPattern() is to be used to return the currency code for the value of the attribute.

20.2.5 What Happens at Runtime: How Currency Is Formatted

At runtime, Applications Core evaluates the bindings generated during design time to generate the correct currency format mask for the value. The fnd:currencyPattern() and fnd:currencyPatternWithPrecisionAndSymbol() Expression Language methods return the format mask for a given currency code, accounting for currency precision, currency symbol, and so on.

20.3 Formatting Dates and Numbers

Dates and numbers may be formatted differently, depending on local standards. For example, some regions may prefer to display the date first followed by the month, and use a decimal separator for numbers with four digits or more (for example, 1.234 to denote one thousand, two hundred and thirty four).

20.3.1 How to Format Dates and Numbers

The first of January 2010 can be displayed as follows:

  • 1.1.10

  • 1-1-10

  • 1/1/10

  • 1/1/2010

  • 2010-01-01 (ISO standard)

Similarly, the number one thousand two hundred and thirty four point five six can display in any of the following formats:

  • 1,234.56

  • 1'234.56

  • 1'234,56

  • 1.234,56

  • 1234.56 (ISO standard)

  • 1234,56

  • 1 234.56

  • 1 234,56

View objects and entity objects can be formatted so as to display date and number data in accordance with local standards. The ISO standard is typically used when it is not desirable to use local standards.

Before you begin:

Create an entity object and a view object with date and number fields, including any of the following attribute types:

  • For numbers: java.math.BigDecimal, java.lang.Integer, or java.lang.Long.

  • For dates: java.sql.Date.

To format dates and numbers:

Date and number values are displayed in the default formatting patterns as follows:

  • dateFormatPattern: dd-MMM-yyyy (for example, 01-Jan-2010)

  • numberFormatPattern: #,##0.### (for example, 1,234.567)

You can customize the date and number formatting patterns by editing the pattern attribute of the af:convertDateTime or af:convertNumber tags.

Note:

Date formatting is applicable only to view object attributes of data type java.sql.Date.

20.3.2 How to Format Numeric IDs and Integers

Not all number values should be formatted using the numberFormatPattern property. For example, a numeric identifier should always be a series of numbers with no locale-sensitive punctuation. The applCorePrefs managed bean provides the numericCodeFormatPattern property to format a numeric code in the same way for all users.

Example 20-5 shows the bindings to the property numericCodeFormatPattern.

Example 20-5 Bindings to the numericCodeFormatPattern Property

<af:convertNumber pattern="#{applCorePrefs.numericCodeFormatPattern}"/>

The intergerFormatPattern property enables formatting an integer, as shown in Example 20-6. No fractions are printed.

Example 20-6 Bindings to the integerFormatPattern Property

<af:convertNumber pattern="#{applCorePrefs.integerFormatPattern}"/>

20.3.3 How to Format the Current Date

Applications often show the current date on the user interface. Correctly identifying the date requires the use of particular APIs.

A server date is calculated by truncating the time portion of the current time from the system clock. However, it may not be appropriate to display the server date to end users, if they are not located in the server time zone. For example, when creating an order, the order form may display with the order date filled out for the end user with the current date. In this case, the order date must be the end user's local date rather than the server date. A server in the US may be serving an end user in China, whose local date may be one day ahead due to time zone differences. It is therefore necessary to adjust the server date to the end user's local date.

Example 20-7 shows how to adjust the server date to the end user's local date.

Example 20-7 Adjusting the Server Date to the Local Date

public Date getCurrentLocalDate() {
    // Get the current date and time.
    long date = new java.util.Date().getTime();
    // Get the user preferred time zone from the ApplCore PreferencesBean.
    TimeZone uptz = TimeZone.getTimeZone(pb.getUPTZ());
    // Get the server time zone.
    TimeZone crtz = TimeZone.getDefault();
    // Calculate the time zone offset difference and return an adjusted date.
    int uptzoff = uptz.getOffset(date);
    int crtzoff = crtz.getOffset(date);
    int diff = uptzoff - crtzoff;
    return new Date(date+diff);
}

Example 20-8 shows the af:inputDate element on the page that sets the adjusted date. This correctly shows the default order date using the individual time zone of the end user.

Example 20-8 Populating the End-user Local Date on a Page

<af:inputDate value="#{localDateBean.currentLocalDate}"
                  label="#{bindings.OrderDate.hints.label}(Type: java.sql.Date)"
                  required="#{bindings.OrderDate.hints.mandatory}"
                  shortDesc="#{bindings.OrderDate.hints.tooltip}"
                  id="id1">
      <f:validator binding="#{bindings.OrderDate.validator}"/>
      <af:convertDateTime pattern="#{userPrefs.dateFormatPattern}"/>
</af:inputDate>

20.3.4 What Happens When You Format Dates and Numbers

All dates and number formatting patterns default to the formats described in Section 20.3.1, "How to Format Dates and Numbers."

When dragging and dropping a view object containing an attribute of type java.math.BigDecimal or java.lang.Integer, or java.lang.Long, Applications Core generates code which binds to the numberFormatPattern property in the applCorePrefs managed bean as shown in Example 20-9.

Example 20-9 Bindings to the numberFormatPattern Property

<af:convertNumber pattern="#{applCorePrefs.numberFormatPattern}"/> 

When dragging and dropping a view object containing an attribute of type java.sql.Date, Applications Core generates code which binds to the dateFormatPattern property in the applCorePrefs managed bean as shown in Example 20-10.

Example 20-10 Bindings to the dateFormatPattern Property

<af:convertDateTime pattern="#{applCorePrefs.dateFormatPattern}"/>

Each code sample calls a date and number preference Applications Programming Interface (API), which obtains the property values from the Applications Session. The Applications Session, in turn, accesses the Oracle Fusion database and returns the correct date or number format.

20.3.5 What Happens at Runtime: How Dates and Numbers Are Formatted

At runtime, the bindings generated at design time are executed. Numbers and dates display according to user preferences for date and number formatting patterns (for example, 01/01/10 and 1,234.567).

20.3.6 Standards and Guidelines

The following standards and guidelines apply to formatting dates and numbers:

  • All date only fields must be represented only by java.sql.Date data types.

  • When a value bound to a field is date only, of type java.sql.Date, make sure not to set the time zone to af:convertDateTime.

20.4 Formatting Time Zones

As opposed to date fields, date and time fields display times within a specific time zone. Date and time fields can be formatted to display in the user-preferred time zone or other applicable time zones.

JSF pages can display two types of dates: those that denote a day and time (January 1, 2008 01:00), and those that denote only the day (January 1, 2008). Date values that include a time component can be displayed with a relevant time zone value, for example, January 1, 2008 01:00 PST. Attributes that hold time zone data allow you to format and display a date-time value in the associated time zone.

Oracle database does not assume any time zone information when storing date information with the data types Date or Timestamp. The Java object types java.util.Date, java.sql.Date, and java.sql.Timestamp, on the other hand, use the UTC (Coordinated Universal Time) time zone. Oracle Java Database Connectivity (JDBC) reconciles the time zone values stored by these different data types by designating a Java Virtual Machine (JVM) default time zone for Oracle Date and Timestamp values. It then converts the values from JVM default time to UTC and vice versa.

According to development standards, developers must not change the JVM default time zone. This presents a challenge when developing an application that requires customized time zone values. The Date-Time Sensitive custom property enables you to properly handle time data while adhering to development standards. The default time zone is the corporate reporting time zone.

Note:

  • Be sure to match the operating system's default zone on all middle tiers to the server time zone (the corporate reporting time zone).

  • In accordance with Oracle Fusion Applications coding standards, time zone sensitive attributes must be of type java.sql.Timestamp. Date only fields must be of type java.sql.Date.

20.4.1 How to Format Time Zones

The Date-Time Sensitive custom property of a view object attribute is used to display time zone data in the relevant time zone—the user preferred time zone or other time zone. The user preferred time zone is retrieved from Oracle Applications Session, whereas the corporate reporting time zone is the default time zone of the server's operating system.

Note:

Values are printed in UPTZ using the setting timeZone="#{applCorePrefs.UPTZ}" rather than the UPTZPattern attribute. The user preferences bean attribute UPTZPattern provides the user preferred formatting pattern for datetime values that do not explicitly print the time zone, such as 1/1/10 12:34 AM for an American user).

Values are printed in LETZ by setting the legal entity time zone to the timeZone attribute. The LETZPattern attribute in the user preferences bean is the user preferred formatting pattern for datetime values that explicitly print the time zone, such as 1/1/10 12:34 AM China Standard Time.

Before you begin:

Create an entity object and a view object.

To format time zones:

  1. In the Projects pane, select the view object.

  2. In the Overview editor, click the Attributes tab, and select the attribute you want to configure as time sensitive.

    Figure 20-1 shows a selected attribute called Timestamp1 in the Attributes tab.

    Figure 20-1 Selecting the Time-Sensitive Attribute

    An image of the attribute selected to be time sensitive.

    Note:

    Time zone sensitivity is applicable only to view object attributes of data type java.sql.Timestamp.
  3. In the Property Inspector, select the Applications tab.

  4. From the Date Time Sensitive dropdown list, select one of the following values:

    • default—Corporate Reporting Time Zone, to display the server time zone. This is the default value.

    • UPTZ—User Preferred Time Zone, to display the user preferred time zone.

    • LETZ—Legal Entity Time Zone, to display the time zone associated with a legal entity.

    Figure 20-2 shows the value UPTZ (User Preferred Time Zone) selected for the DateTime property of the Timestamp1 attribute.

    Figure 20-2 Selecting the Time Zone

    An image of the Date Time Sensitive drop-down list.

Note:

Do not use the Oracle ADF Faces date picker to enable end users to enter a date time value with a time zone. Instead, use a separate time zone selection UI component and use the date picker only for entering dates and times.

20.4.2 How to Format Time with and without Seconds

The user preferred pattern for time formatting might include seconds. In some cases, it may be necessary for an application to display a time value with seconds under one set of circumstances, and without seconds under another.

By default, the display of seconds depends on the user preferred time format. Example 20-11 prints a datetime value in the user preferred format.

Example 20-11 Formatting in the User Preferred Datetime Pattern

<af:convertDateTime pattern="#{applCorePrefs.UPTZPattern}" />

Example 20-12 prints a datetime value in the user preferred format with seconds always included.

Example 20-12 Formatting in the User Preferred Datetime Pattern with Seconds

<af:convertDateTime pattern="#{applCorePrefs.DateFormatPattern} #{applCorePrefs.timeFormatPatternWithSeconds}"/>

Example 20-13 prints a datetime value in the user preferred format without seconds.

Example 20-13 Formatting a Datetime Value in the User Preferred Datetime Pattern without Seconds

<af:convertDateTime pattern="#{applCorePrefs.DateFormatPattern} #{applCorePrefs.timeFormatPatternWithoutSeconds}"/>

20.4.3 How to Format Invariant Time Zone Values

Some datetime values are not associated with a specific time zone. For example, an application may execute a job at 9 AM local time in every location across different time zones. Such values are called invariant or floating times. To print an invariant time zone value, use the default time zone such that no specific time zone is applied to the value.

When printing a datetime value for a specific time zone derived from an invariant time zone value, you may need to adjust the formatting so as to neutralize the effect of time zone conversion. This is because the corporate reporting time zone, the server default, is applied implicitly.

20.4.4 What Happens When You Format Time Zones

Depending on the selected time zone, Applications Core generates tags as shown in Example 20-14 and Example 20-15.

Example 20-14 Default (Corporate Reporting) Time Zone

<af:outputText label="orderDateTime" value="#{bindingToOrderDateTime}"><af:convertDateTime pattern="#{applCorePrefs.UPTZPattern}"/>  <af:outputText>

Example 20-15 User Preferred Time Zone

<af:outputText label="orderDateTime" value="#{bindingToOrderDateTime}"><af:convertDateTime timeZone="#{applCorePrefs.UPTZ}"
 pattern="#{applCorePrefs.UPTZPattern}"/><af:outputText>

At design time, Applications Core uses the Date-Time Sensitive custom property to generate bindings to the time zone attribute on the Oracle ADF Faces Date Time Converter. The attribute is bound to the applCorePrefs managed bean.

20.4.5 What Happens at Runtime: How Time Zones Are Formatted

At runtime, the Applications Core managed bean applCorePrefs—implemented by oracle.apps.fnd.applecore.common.PreferencesBean and registered with faces-config.xml—retrieves the relevant formatting masks from Applications Session.

By default, date-time data may display as shown in Example 20-16.

Example 20-16 Date Time Data Format

1/1/2009 12:34 AM        for the pattern "M/d/yyyy hh:mm a"

20.4.6 Standards and Guidelines

The following standards and guidelines apply to formatting time zones:

  • All date time fields must be represented only by java.sql.Timestamp data types (used by default in time zone view object attributes).

20.5 Formatting Numbers, Currency and Dates Using Localization Expression Language Functions

Expression Language functions provide an alternative to the formatting procedures described in Section 20.2, "Formatting Currency,", Section 20.3, "Formatting Dates and Numbers" and Section 20.4, "Formatting Time Zones."

20.5.1 How to Format Numbers, Currency and Dates Using Expression Language Functions

Oracle ADF Faces Expression Language functions of the type af:formatNamed and af:format only support String objects as parameters. Consequently, other object types such as Date and BigDecimal must be converted to the String object type.

For example, when binding the date object dateValue as shown in Example 20-17, the dateValue object must be converted to a String object by calling the toString() method.

Example 20-17 Binding a Date Object

af:formatNamed(bundle.NOTE_MESSAGE, 'BIRTHDAY', dateValue)

However, the toString() method does not support Oracle Fusion Applications user preferences. Oracle Fusion Applications thus require the use of Expression Language format functions to convert the following data objects to String objects:

  • Number and currency objects:

    • java.math.BigDecimal

    • java.lang.Integer

    • java.lang.Long

  • Date and DateTime (Timestamp) objects:

    • java.sql.Date

    • java.sql.Timestamp

You can format numbers, currency and dates using Expression Language functions.

20.5.1.1 Formatting Numbers Using Expression Language Functions

Use the following Expression Language functions to format numbers.

The number Expression Language formatting function is shown in Example 20-18.

Example 20-18 formatNumber(java.lang.Number value) Function

fnd:formatNumber(java.lang.Number value)

Returns the formatted number value using the user preferences for the number format mask, grouping separator and decimal separator.

This function produces the tag shown in Example 20-19.

Example 20-19 Tag Produced by the Function fnd:formatNumber(java.lang.Number value)

<af:convertNumber pattern="#{applCorePrefs.numberFormatPattern}"/>

An additional Expression Language formatting function for numbers is shown in Example 20-20.

Example 20-20 formatNumber2(java.lang.Number value, int maxFractionDigit) Function

fnd:formatNumber2(java.lang.Number value, int maxFractionDigit)

Returns the formatted number value using the user preferences for the number format mask, grouping separator and decimal separator.

Overrides the scale—the number of digits following the decimal point—of the user preferred number format pattern using the value assigned to maxFractionDigit.

This function produces the tag shown in Example 20-21.

Example 20-21 Tag Produced by the Function fnd:formatNumber2(java.lang.Number value, int maxFractionDigit)

<af:convertNumber pattern="#{applCorePrefs.numberFormatPattern}"
            maxFractionDigits="your scale here"/>

20.5.1.2 Formatting Currency Using Expression Language Functions

Use the Expression Language function shown in Example 20-22 to format currency.

Example 20-22 fnd:formatCurrency(java.lang.Number currencyAmount, java.lang.String currencyCode) Function

fnd:formatCurrency(java.lang.Number currencyAmount,
             java.lang.String currencyCode)

Returns the formatted currency amount value in numeric form along with the relevant currency code. Applications Core uses the currency code as defined in FND_CURRENCIES to format the currencyAmount value, rather than the number format mask preference. User preferences for grouping and decimal separators are used to format the value.

This function produces the tag shown in Example 20-23.

Example 20-23 Tag Produced by the Function fnd:formatCurrency(java.lang.Number currencyAmount, java.lang.String currencyCode)

<af:convertNumber type="currency"
      currencyCode="#{bindings.quantityCurrencyCode.inputValue}"
      pattern="#{fnd:currencyPattern(bindings.quantityCurrencyCode.inputValue)}"/>

20.5.1.3 Formatting Dates Using Expression Language Functions

Use the Expression Language function shown in Example 20-24 to format dates.

Example 20-24 fnd:formatDate(java.util.Date dateValue) Function

fnd:formatDate(java.util.Date dateValue)

Returns the formatted date value based on the user preferred date format mask.

This function produces the tag shown in Example 20-25.

Example 20-25 Tag Produced by the Function fnd:formatDate(java.util.Date dateValue)

<af:convertDateTime pattern="#{applCorePrefs.dateFormatPattern}"/>

Use the Expression Language function shown in Example 20-26 to format date time values.

Example 20-26 fnd:formatDateTime(java.util.Date dateTimeValue) Function

fnd:formatDateTime(java.util.Date dateTimeValue)

Returns the formatted date time value using the user preferences for the date and time format masks and time zone.

This function produces the following tag as shown in Example 20-27.

Example 20-27 Tag Produced by the Function fnd:formatDateTime(java.util.Date dateTimeValue)

<af:convertDateTime type="both" timeZone="#{applCorePrefs.UPTZ}"
              pattern="#{applCorePrefs.UPTZPattern}"/>

Use the Expression Language function shown in Example 20-28 to format date time values with user formatting masks and the user-specified time zone.

Example 20-28 fnd:formatDateTimeTZ(java.util.Date dateTimeValue, java.util.TimeZone timeZone) Function

fnd:formatDateTimeTZ(java.util.Date dateTimeValue,
                         java.util.TimeZone timeZone)

Returns the formatted date time value using the user preferences for date and time format masks and the user-specified time zone.

This function produces the tag shown in Example 20-29.

Example 20-29 Tag Produced by the Function fnd:formatDate(java.util.Date dateTimeValue, java.util.TimeZone timeZone)

<af:convertDateTime type="both" timeZone="<your timezone>"
              pattern="#{applCorePrefs.UPTZPattern}"/>

20.5.2 What Happens When You Format Numbers, Currency and Dates Using Expression Language Functions

Applications Core formats the value as defined by the Expression Language function and produces the tags described in this section.

For example, the date formatting Expression Language function produces a tag such as the one shown in Example 20-30.

Example 20-30 Tag Produced by Expression Language Date Formatting Function

<af:convertDateTime pattern="#{applCorePrefs.dateFormatPattern}"/>

20.5.3 What Happens at Runtime: How Currency, Dates and Numbers and Time Zones are Formatted Using Expression Language Functions

For more information about what happens at runtime when you format numbers, currency and dates using Expression Language functions, see Section 20.2, Section 20.3 and Section 20.4.

20.6 Configuring National Language Support Attributes

In Oracle Fusion Applications, National Language Support (NLS) refers to the ability to run an application instance in any single supported language, including specific regional or territorial number and date formats. Typically, in order to support a given language, only the customer-facing components of the software (user interface, lookup tables, online documentation, and so on) are translated. Translations are delivered via NLS patches.

20.6.1 Session National Language Support Attributes

Oracle Fusion Applications manage NLS attributes at the session level. At runtime, these attributes are initialized based on the user's profile, and are applied when needed by Applications Core. For example, the session date format mask is initialized based on the user's preferred date format mask. The date format mask is automatically applied when date is rendered and parsed. As such, it is unnecessary to manually specify NLS attributes in design time.

In certain situations, however, you may need to access the NLS attributes for the purposes of data formatting or parsing your code. To do so, use the managed bean ApplCorePrefs.

Table 20-1 lists the Oracle Fusion Applications session NLS attributes, the profile used to set each attribute and the possible values for session attributes.

Table 20-1 Session NLS Attributes

Session Attribute Profile Values Comments

LANGUAGE

FND_LANGUAGE

select DESCRIPTION, LANGUAGE_TAG from FND_LANGUAGES_B where INSTALLED_FLAG in ('I', 'B');

Primary attribute used to represent the current language. Corresponds to the LANGUAGE_TAG column in FND_LANGUAGES.

Looks up the corresponding NLS_LANGUAGE and alters the session in the database. Valid examples are es, es-US, fr.

 

NLS_LANG

 

Represents the two letter language code, which is derived using the LANGUAGE attributes. This value is derived rather than explicitly set.

 

NLS_LANGUAGE

 

Represents the NLS language, which is derived from the LANGUAGE attribute. This value is derived rather than explicitly set.

 

NLS_SORT

FND_NLS_SORT

select MEANING, LOOKUP_CODE

from FND_LOOKUPS

where LOOKUP_TYPE = 'NLS_SORT'

and ENABLED_FLAG = 'Y'

and SYSDATE

between START_DATE_ACTIVE and nvl(END_DATE_ACTIVE, SYSDATE+1);

Setting this attribute results in an altered session in the database for the NLS_SORT database attribute.

DATE_FORMAT

FND_DATE_FORMAT

select MEANING, LOOKUP_CODE

from FND_LOOKUPS

where LOOKUP_TYPE = 'DATE_FORMAT'

and ENABLED_FLAG = 'Y' and SYSDATE between START_DATE_ACTIVE and nvl(END_DATE_ACTIVE, SYSDATE+1);

 

TIME_FORMAT

FND_TIME_FORMAT

select MEANING, LOOKUP_CODE

from FND_LOOKUPS

where LOOKUP_TYPE = 'TIME_FORMAT'

and ENABLED_FLAG = 'Y'

and SYSDATE between START_DATE_ACTIVE and nvl(END_DATE_ACTIVE, SYSDATE+1);

 

GROUPING_SEPARATOR

FND_GROUPING_SEPARATOR

select MEANING, LOOKUP_CODE

from FND_LOOKUPS

where LOOKUP_TYPE = 'GROUPING_SEPARATOR'

and ENABLED_FLAG = 'Y'

and SYSDATE between START_DATE_ACTIVE and nvl(END_DATE_ACTIVE, SYSDATE+1);

 

DECIMAL_SEPARATOR

FND_DECIMAL_SEPARATOR

select MEANING, LOOKUP_CODE

from FND_LOOKUPS

where LOOKUP_TYPE = 'DECIMAL_SEPARATOR'

and ENABLED_FLAG = 'Y'

and SYSDATE between START_DATE_ACTIVE and nvl(END_DATE_ACTIVE, SYSDATE+1);

 

CURRENCY

FND_CURRENCY

select NAME, CURRENCY_CODE

from FND_CURRENCIES_VL

where ENABLED_FLAG = 'Y'

and SYSDATE between START_DATE_ACTIVE and nvl(END_DATE_ACTIVE, SYSDATE+1);

This attribute specifies the preferred currency code. It has no corresponding database attribute.

TERRITORY

FND_TERRITORY

select TERRITORY_SHORT_NAME, TERRITORY_CODE from FND_TERRITORIES_VL where ENABLED_FLAG = 'Y';

This attribute specifies the preferred territory. This attribute differs from the database attribute NLS_TERRITORY, as Oracle Fusion Applications supports more territories than the database. The database attribute is permanently set to the value AMERICAN.

TIMEZONE

FND_TIMEZONE

select TIMEZONE_CODE, NAME from FND_TIMEZONES_VL where ENABLED_FLAG = 'Y';

This attribute specifies the preferred time zone value.

CLIENT_ENCODING

FND_CLIENT_ENCODING

select MEANING, LOOKUP_CODE

from FND_LOOKUPS

where LOOKUP_TYPE = 'CLIENT_ENCODING'

and ENABLED_FLAG = 'Y'

and SYSDATE between START_DATE_ACTIVE and nvl(END_DATE_ACTIVE, SYSDATE+1);

 

Table 20-2 lists language and territory values used with NLS attributes.

Table 20-2 Language and Territory Values

LANGUAGE_TAG LANGUAGE_CODE LANGUAGE_ID NLS_LANGUAGE NLS_TERRITORY ISO_LANGUAGE ISO_TERRITORY NLS_CODESET ISO_LANGUAGE_3

ar

AR

8

ARABIC

UNITED ARAB EMIRATES

ar

AE

AR8ISO8859P6

ara

bg

BG

101

BULGARIAN

BULGARIA

bg

BG

CL8ISO8859P5

bul

ca

CA

102

CATALAN

CATALONIA

ca

CT

WE8ISO8859P1

cat

cs

CS

30

CZECH

CZECH REPUBLIC

cs

CZ

EE8ISO8859P2

ces

de

D

4

GERMAN

GERMANY

de

DE

WE8ISO8859P1

deu

da

DK

5

DANISH

DENMARK

da

DK

WE8ISO8859P1

dan

es

E

11

SPANISH

SPAIN

es

ES

WE8ISO8859P1

spa

eg

EG

118

EGYPTIAN

EGYPT

eg

EG

AR8ISO8859P6

egy

el

EL

104

GREEK

GREECE

el

GR

EL8ISO8859P7

ell

es-US

ESA

29

LATIN AMERICAN SPANISH

AMERICA

es

US

WE8ISO8859P1

spa

fr

F

2

FRENCH

FRANCE

fr

FR

WE8ISO8859P1

fra

fr-CA

FRC

3

CANADIAN FRENCH

CANADA

fr

CA

WE8ISO8859P1

fra

en-GB

GB

1

ENGLISH

UNITED KINGDOM

en

GB

WE8ISO8859P1

eng

hr

HR

103

CROATIAN

CROATIA

hr

HR

EE8ISO8859P2

hrv

hu

HU

28

HUNGARIAN

HUNGARY

hu

HU

EE8ISO8859P2

hun

it

I

108

ITALIAN

ITALY

it

IT

WE8ISO8859P1

ita

is

IS

106

ICELANDIC

ICELAND

is

IS

WE8ISO8859P1

isl

he

IW

107

HEBREW

ISRAEL

he

IL

IW8ISO8859P8

heb

ja

JA

15

JAPANESE

JAPAN

ja

JP

JA16EUC

jpn

ko

KO

16

KOREAN

KOREA

ko

KR

KO16KSC5601

kor

lt

LT

109

LITHUANIAN

LITHUANIA

lt

LT

NEE8ISO8859P4

lit

no

N

10

NORWEGIAN

NORWAY

no

NO

WE8ISO8859P1

nor

nl

NL

6

DUTCH

THE NETHERLANDS

nl

NL

WE8ISO8859P1

nld

pl

PL

110

POLISH

POLAND

pl

PL

EE8ISO8859P2

pol

pt

PT

18

PORTUGUESE

PORTUGAL

pt

PT

WE8ISO8859P1

por

pt-BR

PTB

26

BRAZILIAN PORTUGUESE

BRAZIL

t

BR

WE8ISO8859P1

por

ro

RO

111

ROMANIAN

ROMANIA

ro

RO

EE8ISO8859P2

ron

ru

RU

112

RUSSIAN

RUSSIA

ru

RU

CL8ISO8859P5

rus

sv

S

13

SWEDISH

SWEDEN

sv

SE

WE8ISO8859P1

swe

fi

SF

7

FINNISH

FINLAND

fi

FI

WE8ISO8859P1

fin

sk

SK

113

SLOVAK

SLOVAKIA

sk

SK

EE8ISO8859P2

slk

sl

SL

114

SLOVENIAN

SLOVENIA

sl

SI

EE8ISO8859P2

slv

th

TH

115

THAI

THAILAND

th

TH

TH8TISASCII

tha

tr

TR

116

TURKISH

TURKEY

tr

TR

WE8ISO8859P9

tur

en

US

0

AMERICAN

AMERICA

en

US

US7ASCII

eng

zh-CN

ZHS

14

SIMPLIFIED CHINESE

CHINA

zh

CN

ZHS16CGB231280

zho

zh-TW

ZHT

117

TRADITIONAL CHINESE

TAIWAN

zh

TW

ZHT16BIG5

zho

sq

SQ

67

ALBANIAN

ALBANIA

sq

AL

EE8ISO8859P2

sqi

vi

VN

43

VIETNAMESE

VIETNAM

vi

VN

VN8MSWIN1258

vie

id

IN

46

INDONESIAN

INDONESIA

id

ID

WE8ISO8859P1

ind


20.6.2 Database Session Attributes

Oracle Fusion Applications does not use most of the database session NLS parameters. Instead, these are set to constant values such that typically, the user's preferred values are not reflected. This is true for most parameters except the following: NLS_LANGUAGE which is set to view link view access, and NLS_SORT, which is set to use the database linguistic sorting functionality.

The parameters TO_NUMBER, TO_DATE, TO_TIMESTAMP and TO_CHAR are used to format and parse SQL or PL/SQL statements. These parameters are based on constant values, the canonical format. The parameter FND_DATE for PL/SQL packages also works with the canonical format. Formatting and parsing should be done at the presentation, rather than the model layer.

Oracle Fusion Applications session management controls database session parameters. As such, the database NLS session parameter values must not be altered.

Table 20-3 lists the following:

  • Database attribute: The database NLS session parameter name.

  • Associated session attribute: The Oracle Fusion Applications NLS session attribute name related to the database attribute name, if one exists. If the attributes are indeed related, configuring a value for the Oracle Fusion Applications NLS session attribute results in an ALTER SESSION in the database layer.

  • Default value: The default value of the attribute. This value is configured both in the database and init.ora as the database default.

  • Alter Session: Indicates whether an ALTER SESSION is created in the database. When an ALTER SESSION initiates at session creation or attachment, execute NLS_LANGUAGE and NLS_TERRITORY first, as these may affect other attributes.

    • Create: An ALTER SESSION is created once, when the connection is first created.

    • Update: The ALTER SESSION updates when the session attaches, or whenever an associated attribute value changes mid-session.

    • Never: An ALTER SESSION is not created, and the default database value is unchanged.

Table 20-3 Localization Database Attributes

Database Attribute Default Value Alter Session Comments

NLS_CALENDAR

None

Never

This attribute need not be set as the default value is GREGORIAN. Accept the default value.

NLS_COMP

None

Never

This attribute need not be set as the default value is BINARY. Accept the default value.

NLS_CURRENCY

None

Never

Accept the default value.

NLS_DATE_FORMAT

YYYY-MM-DD

Create

Fixed value.

NLS_DATE_LANGUAGE

NUMERIC DATE LANGUAGE

Create

Fixed value. Does not require an attribute or profile.

NLS_ISO_CURRENCY

None

Never

Accept the default value.

NLS_LANGUAGE

None

Update

The value of this attribute is based on the LANGUAGE session attribute. See the LANGUAGE attribute in Table 20-1.

NLS_TERRITORY

AMERICA

Create

The value of this attribute is fixed. See the TERRITORY attribute in Table 20-1.

NLS_LENGTH_SEMANTICS

CHAR

Create

Fixed value. Does not require an attribute or profile.

NLS_NCHAR_CONV_EXCP

None

Never

Accept the default value. This parameter is not used.

NLS_NUMERIC_CHARACTERS

,.

Create

Fixed value. Choose group and decimal separators independently.

NLS_SORT

None

Update

In order to enable linguistic sorting, the NLS_SORT session attribute is used to set the value for this database attribute. See the NLS_SORT session attribute in Table 20-1.

NLS_TIME_FORMAT

HH24:MI:SS.FF

Create

Fixed value. Does not require an attribute or profile.

NLS_TIME_TZ_FORMAT

HH24:MI:SS.FF TZR

Create

Fixed value. Does not require an attribute or profile.

NLS_TIMESTAMP_FORMAT

YYYY-MM-DD HH24:MI:SS.FF

Create

Fixed value. Does not require an attribute or profile.

NLS_TIMESTAMP_TZ_FORMAT

YYYY-MM-DD HH24:MI:SS.FF TZR

Create

Fixed value. Does not require an attribute or profile.

NLS_DUAL_CURRENCY

None

Never

Accept the default value.


Note:

As the language attributes tracked on the session reflect Java values, you cannot use them for formatting on the PL/SQL layer.

20.7 Standards and Guidelines for Localization Formatting

The following standards and guidelines apply to localization formatting: