Busy localization - support for plurals

in #utopian-io2 years ago (edited)


As you know Busy supports many languages right now, and more and more are coming everyday, thanks to contributions in Crowdin project https://crowdin.com/project/busy. I also participate in this translation project and because I am Polish, one thing still bugs me. In Polish localization there is no plural forms of words like "votes", "comments", "likes" and so on. English language uses two forms, while in Polish we have four, and in Welsh there is even six forms. You can check, plural language rules for different languages here http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html.

Screenshot from 2018-01-04 10-59-02.png


Implement pluralizers package https://www.npmjs.com/package/pluralizers into Busy platform. This will also require to update .json localization templates according to this https://formatjs.io/guides/message-syntax/#plural-format:
Screenshot from 2018-01-04 12-18-16.png

Each language should use English pluralizers function as default, unless someone create proper function for it. I can do it for Polish. Information about this feature could be inserted in Crowdin project page.

Here is example function code for Polish, basing on Russian example from github repo:

'use strict';

module.exports = function(entry, count) {
  var key;

  var m10 = count % 10;
  var m100 = count % 100;

  if (count === 0 && 'zero' in entry) {
    key = 'zero';
  } else if (count === 1) {
    key = 'one';
  } else if ([2, 3, 4].indexOf(m10) >= 0 && [12, 13, 14].indexOf(m100) < 0) {
    key = 'few';
  } else if (m10 === 0 || [5, 6, 7, 8, 9].indexOf(m10) >= 0 || [11, 12, 13, 14].indexOf(m100) >= 0) {
    key = 'many';
  } else {
    key = 'other';

  return entry[key];

Thank you for the reading.

Posted on Utopian.io - Rewarding Open Source Contributors


Thank you for the contribution. It has been approved.

You can contact us on Discord.

We are currently thinking about updating the way we handle translations, because they are not very flexible. We currently use react-intl for this, but might switch to some other solution.
It should get better soon.

Hey @donpepe I am @utopian-io. I have just upvoted you!


  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!


  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!


Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

nice to transi.

Your contribution cannot be approved yet because it is attached to the wrong repository. Please edit your contribution and fix the repository to reapply for approval.

Please post Busy's official repo.

You may edit your post here, as shown below:

You can contact us on Discord.

Hi @deathwing, it is fixed. Thanks.

You got a 0.28% upvote from @upme requested by: @donpepe.
Send at least 1.5 SBD to @upme with a post link in the memo field to receive upvote next round.
To support our activity, please vote for my master @suggeelson, as a STEEM Witness