/** * <p> * Creates a new {@link Pluralizer} instance for the default locale. * </p> * @return a pluralizer instance for the default locale */ public static Pluralizer pluralizer() { return pluralizer(Locale.getDefault()); }
/** * <p> * Creates a new {@link Pluralizer} instance for the default locale. * </p> * @return a pluralizer instance for the default locale */ public static Pluralizer pluralizer() { return pluralizer(Locale.getDefault()); }
/** * <p> * Converts a noun to its plural form using the {@link Pluralizer} for the default locale. * </p> * <p> * The return value is not defined if this method is passed a plural form. * </p> * @param word a singular form * @return the plural form */ public static String pluralOf(String word) { return pluralOf(word, pluralizer()); }
/** * <p> * Converts a noun to its plural form using the {@link Pluralizer} for the default locale. * </p> * <p> * The return value is not defined if this method is passed a plural form. * </p> * @param word a singular form * @return the plural form */ public static String pluralOf(String word) { return pluralOf(word, pluralizer()); }
/** * <p> * Converts a noun to its plural form for the given number of instances * using the {@link Pluralizer} for the default locale. * </p> * <p> * The return value is not defined if this method is passed a plural form. * </p> * @param word a singular form * @param number the number of objects being referred to in the plural * @return the plural form */ public static String pluralOf(String word, int number) { return pluralOf(word, number, pluralizer()); }
/** * <p> * Converts a noun to its plural form using the {@link Pluralizer} for the given locale. * </p> * <p> * The return value is not defined if this method is passed a plural form. * </p> * @param word a singular form * @param locale the locale specifying the language of the pluralizer * @return the plural form */ public static String pluralOf(String word, Locale locale) { return pluralOf(word, pluralizer(locale)); }
/** * <p> * Converts a noun to its plural form for the given number of instances * using the {@link Pluralizer} for the default locale. * </p> * <p> * The return value is not defined if this method is passed a plural form. * </p> * @param word a singular form * @param number the number of objects being referred to in the plural * @return the plural form */ public static String pluralOf(String word, int number) { return pluralOf(word, number, pluralizer()); }
/** * <p> * Converts a noun to its plural form using the {@link Pluralizer} for the given locale. * </p> * <p> * The return value is not defined if this method is passed a plural form. * </p> * @param word a singular form * @param locale the locale specifying the language of the pluralizer * @return the plural form */ public static String pluralOf(String word, Locale locale) { return pluralOf(word, pluralizer(locale)); }
/** * <p> * Converts a noun to its plural form for the given number of instances * using the {@link Pluralizer} for the given locale. * </p> * <p> * The return value is not defined if this method is passed a plural form. * </p> * @param word a singular form * @param number the number of objects being referred to in the plural * @param locale the locale specifying the language of the pluralizer * @return the plural form */ public static String pluralOf(String word, int number, Locale locale) { return pluralOf(word, number, pluralizer(locale)); }
/** * <p> * Converts a noun to its plural form for the given number of instances * using the {@link Pluralizer} for the given locale. * </p> * <p> * The return value is not defined if this method is passed a plural form. * </p> * @param word a singular form * @param number the number of objects being referred to in the plural * @param locale the locale specifying the language of the pluralizer * @return the plural form */ public static String pluralOf(String word, int number, Locale locale) { return pluralOf(word, number, pluralizer(locale)); }
/** */ @SuppressWarnings("unchecked") private static void fillCustomPluralization() { ArrayList<Object> tmpRule = (ArrayList<Object>) Config.config.getList("customPluralization.rule[@regexmatch]"); List<Rule> customRules = new ArrayList<Rule>(); for (int i = 0; i < tmpRule.size(); i++) { String match = Config.config.getString(String.format("customPluralization.rule(%d)[@regexmatch]", i), "*"); String replace = Config.config.getString(String.format("customPluralization.rule(%d)[@regexreplace]", i), ""); customRules.add(new RegexReplacementRule(match, replace)); } State.getInstance().setCustomPluralizer(new RuleBasedPluralizer(customRules, Locale.ENGLISH, Noun.pluralizer(Locale.ENGLISH))); }