sonic-pi

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

C++

Code. Music. Live.

Locale.candidates

Returns the language tags which are variations of the current locales order by priority.

For example, if the current locales are ["fr", "ja_JP", "en_US", "en-Latn-GB-VARIANT"], 
then returns ["fr", "ja_JP", "en_US", "en-Latn-GB-VARIANT", "en_Latn_GB", "en_GB", "ja", "en"].
"en" is the default locale(You can change it using set_default). 
The default locale is added at the end of the list even if it isn't exist.

Usually, this method is used to find the locale data as the path(or a kind of IDs).
* options: options as a Hash or nil.
  * :supported_language_tags - 
    An Array of the language tags order by the priority. This option 
    restricts the locales which are supported by the library/application.
    Default is nil if you don't need to restrict the locales.
     (e.g.1) ["fr_FR", "en_GB", "en_US", ...]
  * :type - 
    The type of language tag. :common, :rfc, :cldr, :posix and 
    :simple are available. Default value is :common

Source | Google | Stack overflow

Edit

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

cd sonic-pi

open app/server/ruby/vendor/locale-2.1.2/lib/locale.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Locale-candidates-for-pr


# Commit to git

git add app/server/ruby/vendor/locale-2.1.2/lib/locale.rbgit commit -m "better docs for Locale.candidates"


# Open pull request

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

hub fork

git push <your name> -your-name--update-docs-Locale-candidates-for-pr

hub pull-request


# Celebrate!