public class PrettyLocaledTexts extends Object
|Constructor and Description|
Creates an instance of used for the application session and its locale.
|Modifier and Type||Method and Description|
Gets the distance.
Gets the duration.
Gets the system default instance for PrettyLocaledTexts.
public PrettyLocaledTexts(ILocaleString localeString)
localeString- The locale string instance, null for system default.
public static PrettyLocaledTexts getDefault()
public String decorateDuration(long duration, long now, int precision, int form)
duration- The duration in seconds (absolute value is used).
now- The amount of seconds considered as "now".
precision- 0=seconds, 1=minutes, 2=hours, 3=days, 4=weeks.
form- The form: 0=short, 1=medium, 2=long, 3=long with "one" as text.
IllegalArgumentException- If the form is not 0-3 or precision not 0-3.
public String decorateDistance(long distance, long here, int precision, int form)
If the distance is less than "here", "near" or "close by" is always returned, regardless of precision.
If precision is 1=kilometer and the distance is less than 1000, "less than a kilometer" is returned.
distance- The distance in meters (absolute value is used).
here- The amount of meters considered as "here" or "nearby".
precision- Precision: 0=meters, 1=kilometers.
form- The form: 0=short, 1=long, 2=long with "one" as text.
IllegalArgumentException- If the form is not 0-2.
public static void main(String args)
iizi® is a registered trademark of Mindus SARL. © Copyright 2019 Mindus SARL. All rights reserved.