Skip to content

Use Locale.ROOT for country codes and format labels - #161

Merged
ounben merged 4 commits into
ounben:masterfrom
Verlintas:fix/locale-independent-codes
Nov 13, 2026
Merged

ounben merged 4 commits into
ounben:masterfrom
Verlintas:fix/locale-independent-codes

Conversation

@Verlintas

@Verlintas Verlintas commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Country codes and recording formats are uppercased with the device locale. In Turkish/Azeri locales "in".uppercase() becomes "İN" (dotted capital İ), which breaks two things:

  • EmojiUtils.getFlagEmoji() computes the regional-indicator code points from A–Z (codePoint - 0x41 + 0x1F1E6), so a non-ASCII letter produces a bogus symbol instead of the flag — e.g. India (IN), Italy (IT), Ireland (IE) show a wrong glyph when the stored code is lowercase.
  • The same uppercased code is rendered in the tab title and settings list, so users see İN instead of IN.

Fix

Use Locale.ROOT wherever these strings are identifiers rather than display text:

  • EmojiUtils.getFlagEmoji() normalises the code once with uppercase(Locale.ROOT).
  • TabsScreen / SettingsScreen uppercase country codes for the flag and label with Locale.ROOT.
  • RecordingsTab uppercases recording format labels (mp3 → MP3) with Locale.ROOT.

No change for Latin locales; this only removes the locale-dependent behaviour for identifier strings.

AI disclosure

This PR was authored by an AI coding agent (OpenCode, running DeepSeek V4.1 Flash) under human supervision: the change, tests and description were generated by the agent and reviewed by the contributor before submission.

@ounben ounben self-assigned this Nov 12, 2026
@ounben ounben added the bug Something isn't working label Nov 12, 2026
@ounben

ounben commented Nov 12, 2026

Copy link
Copy Markdown
Owner

https://sam-cooper.medium.com/the-country-that-broke-kotlin-84bdd0afb237

https://developer.android.com/reference/java/util/Locale#ROOT

Useful constant for the root locale. The root locale is the locale whose language, country, and variant are empty ("") strings. This is regarded as the base locale of all locales, and is used as the language/country neutral locale for the locale sensitive operations.

PR looks good and it's a bug that I did not see or thought about. After double checking in Android Studio it will be merged.

@ounben ounben added this to the November Release milestone Nov 12, 2026
@ounben
ounben self-requested a review November 13, 2026 16:12

@ounben ounben left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff: putExtra(Intent.EXTRA_TEXT, "${record.Name}\nRecording: ${record.format.uppercase(Locale.ROOT)}")

@ounben ounben left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff: val code = item.code?.uppercase(Locale.ROOT) ?: return@mapNotNull null

@ounben ounben left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff: import java.util.Locale - local.ROOT

@ounben ounben left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff: ASCII

@ounben
ounben merged commit 7267655 into ounben:master Nov 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants