MarkTiedemann / mtff

Mark's Translation File Format.
MIT License
1 stars 0 forks source link

What about plural form ? #1

Open Arteneko opened 6 years ago

Arteneko commented 6 years ago

The title says it all, what about plural form in translations ?

For example, the po format supports it, and in some cases, it can be pretty useful.

MarkTiedemann commented 6 years ago

@IvanDelsinne Do you have an idea for how to support singular/plural with an intuitive syntax?

The main reason I didn't add singular/plural or gender yet is that I want this format to be easy to learn - even for non-developers.

For example, I think that ICU expressions are just very easy to get wrong - even for developers.

Updated {minutes, plural, =0 {just now} =1 {one minute ago} other {{{minutes}} minutes ago}}
The author is {gender, select, male {male} female {female} other {other}}

These are not intuitive, in my opinion.

So in my ideal world, the developer would write code like this:

// pseudo-code
switch (customer_count) {
  case 0:  i18n.no_customers_yet;
  case 1:  i18n.single_customer;
  default: i18n.many_customers;
}

And there would be a translation file like this:

~ no_customers_yet
  en: Damn, you have no customers yet!
  de: Oh je, du hast noch keine Kunden!

~ single_customer
  en: Yay, you got a customer!
  de: Juhu, du hast einen Kunden!

~ many_customers
  en: So many customers, much wow!
  de: So viele Kunden, echt krass!

This translation file is so simple, you can write it by hand. Maybe one of the support guys on the team is bilingual and can just simply open a text editor and help translate the app, you know - that's the kind of use-case I'm going for here.

Looking forward to more feedback! :)