From c54b6de2271e87a11e4d331b0f61e1b74a79d505 Mon Sep 17 00:00:00 2001 From: Lukasz Pik Date: Mon, 16 Oct 2017 19:06:56 +0200 Subject: [PATCH] [ACR-661] Added measure guides PS2: Reviewed Change-Id: Ie5b2b10134c0d451b6d9f0352bc2dbd007a6fa91 Signed-off-by: Lukasz Pik --- .../html/native/internationalization/i18n_n.htm | 58 +++++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/org.tizen.guides/html/native/internationalization/i18n_n.htm b/org.tizen.guides/html/native/internationalization/i18n_n.htm index a95b050..8378052 100644 --- a/org.tizen.guides/html/native/internationalization/i18n_n.htm +++ b/org.tizen.guides/html/native/internationalization/i18n_n.htm @@ -45,6 +45,7 @@
  • Alphabetic Index Creation
  • Field Identification in Formatted Output
  • String Format Management
  • +
  • Measurement Values with Units
  • Time Scale Conversion with Utmscale
  • String Iteration with UCharIter
  • Prerequisites
  • @@ -59,6 +60,7 @@
  • Managing Alphabetic Indexes
  • Managing the Field Position
  • Managing String Formatting
  • +
  • Managing Measure Objects
  • Converting Time Scales
  • Retrieving the ICU Version
  • Iterating through Strings
  • @@ -99,6 +101,8 @@

    You can identify fields for formatting purposes with FieldPosition.

  • Managing string formatting

    You can use the Format functions to manage the string representations of objects or values.

  • +
  • Managing measurement values with units +

    You can store numeric measurement values with various units.

  • Converting time scales

    You can convert datetimes between time scales with Utmscale.

  • Retrieving the ICU version @@ -110,7 +114,7 @@
    Note - The Alphabetic Index, FieldPosition, Format, and Utmscale APIs are supported since Tizen 3.0. The Uversion and UCharIter APIs are supported since Tizen 4.0. + The Alphabetic Index, FieldPosition, Format, Measure, and Utmscale APIs are supported since Tizen 3.0. The Uversion and UCharIter APIs are supported since Tizen 4.0.

    Location Boundaries with Ubrk

    @@ -586,6 +590,11 @@

    The Format API specifies the protocol for classes which convert between objects or values, such as numeric values and dates, and their string representations. These representations can be localized or contain localized characters or strings.

    There is no function for creating an i18n_format_h object, as this module uses a mechanism similar to inheritance in object-oriented languages. All functions with the i18n_format_h handle as a parameter can instead take the handle to a more specific format object from the derived classes.

    +

    Measurement Values with Units

    +

    The Measure API (in mobile and wearable applications) allows you to create measure objects containing a numerical value and a measurement unit. You can, for example, store a length value in feet or meters.

    + +The measure objects can be formatted using the MeasureFormat API (in mobile and wearable applications). +

    Time Scale Conversion with Utmscale

    The Utmscale API (in mobile and wearable applications) allows you to convert between time scales.

    There are various conventions for binary datetime, depending on the platform and protocol. Some of these have severe drawbacks. For example, 32-bit Unix time (seconds since Jan 1, 1970) cannot support datetimes beyond the beginning of the year 2038. Arithmetic manipulations can also cause serious problems. For example, when calculating the average of 2 datetimes, if you calculate them with average_time = (time1 + time2)/2, there can be overflow even with dates around the present. Additionally, there is the issue of converting between different systems.

    @@ -720,7 +729,6 @@

    ICU implements the .NET framework System.DateTime as the universal time scale 'pivot', and uses the full range allowed by the datatype, allowing for datetimes back to 29,000 BC and up to 29,000 AD. This time scale is very fine-grained, does not lose precision, and covers a range that meets most requirements. Using the Utmscale functions, datetimes can be converted to the pivot time scale, safely manipulated, and converted back to any other time scale.

    -

    String Iteration with UCharIter

    The UCharIter API (in mobile and wearable applications) allows you to iterate through strings.

    The current() and next() functions only check the current index against the limit, and the previous() function only checks the current index against the start, to see if the iterator has already reached the beginning of the iteration range. The assumption - in all iterators - is that the index is moved though the API, which means that it cannot go out of bounds, or that the index is modified though the application code by a developer who knows enough about the iterator implementation to set valid index values.

    @@ -2068,6 +2076,52 @@ i18n_format_destroy(format);
  • +

    Managing Measure Objects

    +

    Since Tizen 3.0, you can use the Measure API (in mobile and wearable applications) to create measure objects, containing a numerical value and a measurement unit.

    + +
    + Note + A measure object is immutable, so if you want to change its value, you must create a new object with the new value. +
    + +

    To manage measure objects:

    +
      +
    1. To create a measure object: +
      +i18n_measure_h measure;
      +i18n_formattable_h formattable;
      +i18n_measure_unit_h unit;
      +double value = 7;
      +
      +i18n_formattable_create_with_double(value, &formattable);
      +i18n_measure_unit_create_gigabit(&unit);
      +
      +i18n_measure_create(formattable, unit, &measure);
      +/* Created object contains "7 Gigabits" */
      +
    2. +
    3. To clone a measure object: +
      +i18n_measure_h clone;
      +i18n_measure_clone(measure, &clone);
      +
    4. +
    5. To get the numeric value: +
      +i18n_formattable_h formattable;
      +i18n_measure_get_number(measure, &formattable);
      +/* formattable contains 7 as double */
      +
    6. +
    7. To get the measurement unit: +
      +i18n_measure_unit_h unit;
      +i18n_measure_get_unit(measure, &unit);
      +/* unit contains Gigabits value */
      +
    8. +
    9. When no longer needed, destroy the measure object: +
      +i18n_measure_destroy(measure);
      +
    10. +
    +

    Converting Time Scales

    Since Tizen 3.0, you can use the Utmscale API (in mobile and wearable applications) to convert binary datetimes between various platform-dependent time scales.

    To convert a datetime value:

    -- 2.7.4