opral / inlang-message-sdk

0 stars 0 forks source link

Requirements for gender and plurals #40

Open jldec opened 2 months ago

jldec commented 2 months ago

Context

Users are asking for inlang to support messages with variant for gender and plurals.

Proposal

Introduce new types which are aligned with ICU Message Format 2 messages and a new message bundle type to collect messages translated for different locales.

W1M0R commented 1 month ago

This format for pluralization seems to be very flexible, in case this matches your goals: https://github.com/nicksnyder/go-i18n/blob/b42d9bd0c568eebf5ce123ec94b9b13438f46855/i18n/bundle_test.go#L101

image

In this example, "simple", "detail", and "everything" are the translation keys, and "zero", "one", "two", "few", "many" and "other" are the different plural forms for the specific translation.

pichfl commented 1 month ago

How about https://github.com/unicode-org/message-format-wg/blob/main/spec/formatting.md which is the formal spec for the ICU Message and is also implemented in Format.JS https://formatjs.io/docs/core-concepts/icu-syntax/#plural-format

LorisSigrist commented 1 month ago

@pichfl Good Shout! The ICU MessageFormat 2.0 is actually what we're focussing our internal efforts on

pichfl commented 1 month ago

Much appreciated! I'm involved in a few larger projects in desperate need of this, so if there is anything else I can do to move things along, I'd be happy to help.