- // Store the populated string builder in the locale string.
- localesStringBuilder.toString()
- } else { // SDK < 24 only has a primary locale.
- // Store the locale in the locale string.
- Locale.getDefault().toString()
+ // Add a second entry for the language only portion of the locale.
+ localesStringBuilder.append(",")
+ localesStringBuilder.append(locale.language)
+
+ // Append `1;q=0.x`, which drops by .1 for each removal form the main locale until q=0.1.
+ localesStringBuilder.append(";q=0.")
+ localesStringBuilder.append(q)
+
+ // Decrement `q` if it is greater than 1.
+ if (q > 1) {
+ q--
+ }