Example usage for com.google.gwt.i18n.client PluralRule select

List of usage examples for com.google.gwt.i18n.client PluralRule select

Introduction

In this page you can find the example usage for com.google.gwt.i18n.client PluralRule select.

Prototype

int select(int n);

Source Link

Document

Returns the plural form appropriate for this count.

Usage

From source file:com.mattbertolini.hermes.CustomPlural.java

License:Open Source License

public static Plural fromNumber(PluralRule rule, int num) {
    Plural retVal = null;/*  ww  w .ja  v  a2  s  . com*/
    int index = rule.select(num);
    String ruleName = rule.pluralForms()[index].getName();
    if (ruleName == null || ruleName.equals(EMPTY_STRING) || ruleName.equals(OTHER)) {
        retVal = GwtPlural.OTHER;
    } else {
        retVal = new CustomPlural(ruleName);
    }
    return retVal;
}