Java internationalization (i18n) with proper plurals

Well, you already tagged the question correctly, so I assume you know thing or two about ICU. With ICU you have two choices for proper handling of plural forms: PluralRules, which gives you the rules for given Locale PluralFormat, which uses aforementioned rules to allow formatting Which one to use? Personally, I prefer to use … Read more

Plural definition is ignored for zero quantity

According to the documentation : The selection of which string to use is made solely based on grammatical necessity. In English, a string for zero will be ignored even if the quantity is 0, because 0 isn’t grammatically different from 2, or any other number except 1 (“zero books”, “one book”, “two books”, and so … Read more

JavaScript pluralize an english string

Simple version (ES6): const pluralize = (count, noun, suffix = ‘s’) => `${count} ${noun}${count !== 1 ? suffix : ”}`; Typescript: const pluralize = (count: number, noun: string, suffix = ‘s’) => `${count} ${noun}${count !== 1 ? suffix : ”}`; Usage: pluralize(0, ‘turtle’); // 0 turtles pluralize(1, ‘turtle’); // 1 turtle pluralize(2, ‘turtle’); // 2 … Read more

How to use Android quantity strings (plurals)

You don’t need to set the “formatted” attribute for any of those items. When using quantity strings, there are only three possibilities: the resource string is plain text and does not contain any parameters the resource string contains only one parameter (most likely the quantity); use %d or whatever format you need the resource string … Read more

i18n Pluralization

Try this: en.yml : en: misc: kids: zero: no kids one: 1 kid other: %{count} kids In a view: You have <%= t(‘misc.kids’, :count => 4) %> Updated answer for languages with multiple pluralization (tested with Rails 3.0.7): File config/initializers/pluralization.rb: require “i18n/backend/pluralization” I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization) File config/locales/plurals.rb: {:ru => { :i18n => { :plural => { … Read more

Enum Naming Convention – Plural

Microsoft recommends using singular for Enums unless the Enum represents bit fields (use the FlagsAttribute as well). See Enumeration Type Naming Conventions (a subset of Microsoft’s Naming Guidelines). To respond to your clarification, I see nothing wrong with either of the following: public enum OrderStatus { Pending, Fulfilled, Error }; public class SomeClass { public … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)