sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

GetText::TextDomainManager#translate_plural_message

This function is similar to the get_singular_message function
as it finds the message catalogs in the same way.
But it takes two extra arguments for plural form.
The msgid parameter must contain the singular form of the string to be converted.
It is also used as the key for the search in the catalog.
The msgid_plural parameter is the plural form.
The parameter n is used to determine the plural form.
If no message catalog is found msgid1 is returned if n == 1, otherwise msgid2.
And if msgid includes "div", it returns a last part of msgid separeted "div".

* msgid: the singular form with "div". (e.g. "Special|An apple", "An apple")
* msgid_plural: the plural form. (e.g. "%{num} Apples")
* n: a number used to determine the plural form.
* div: the separator. Default is "|".
* Returns: the localized text which key is msgid_plural if n is plural(follow plural-rule) or msgid.
  "plural-rule" is defined in po-file.

or

* [msgid, msgid_plural] : msgid and msgid_plural an Array
* n: a number used to determine the plural form.
* div: the separator. Default is "|".

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/gettext-3.4.3/lib/gettext/text_domain_manager.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-GetText--TextDomainManager-translate_plural_message-for-pr


# Commit to git

git add app/server/ruby/vendor/gettext-3.4.3/lib/gettext/text_domain_manager.rbgit commit -m "better docs for GetText::TextDomainManager#translate_plural_message"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-GetText--TextDomainManager-translate_plural_message-for-pr

hub pull-request


# Celebrate!