MBS-7672, MBS-7673: sort link type/target type dropdowns in relationship editor
mwiencek
Branch: mwiencek/musicbrainz-server:mbs-7672
mwiencek/musicbrainz-server:mbs-7672
Branch: metabrainz/musicbrainz-server:beta
metabrainz/musicbrainz-server:beta
Merged
#1058 · Created  · Last updated
Description
This sorts link types by child order and then by phrase according to the user's language. It picks up the language tag from the html lang attribute. Target types are also sorted.
The second MDN link says that "In older implementations, which ignore the locales and options arguments, the locale and sort order used are entirely implementation dependent."
This sorts link types by child order and then by phrase according to the user's language. It picks up the language tag from the html lang attribute. Target types are also sorted.
The language/locale-sensitive comparison functionality isn't available in every browser; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator#Browser_Compatibility and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#Browser_compatibility
The second MDN link says that "In older implementations, which ignore the locales and options arguments, the locale and sort order used are entirely implementation dependent."
I viewed things in Chrome, Opera 12, and IE 10 under en, de, and es. I didn't pass any options to the Intl constructor, but maybe I should (see the sensitivity, ignorePunctuation, numeric, caseFirst options on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator#Parameters).