comparable static method
First: The TranslatedString in the default locale. Then: The other TranslatedStrings with the same language as the default locale. Then: The other TranslatedStrings, in alphabetic order.
Implementation
static int Function(TranslatedString, TranslatedString) comparable(
String defaultLocaleStr,
) =>
(ts1, ts2) {
if (ts1.locale == defaultLocaleStr) return -1;
if (ts2.locale == defaultLocaleStr) return 1;
var defaultLanguageStr = defaultLocaleStr.substring(0, 2);
if (ts1.locale.startsWith(defaultLanguageStr) && !ts2.locale.startsWith(defaultLocaleStr))
return -1;
if (ts2.locale.startsWith(defaultLanguageStr) && !ts1.locale.startsWith(defaultLocaleStr))
return 1;
return ts1.locale.compareTo(ts2.locale);
};