Skip to content

fix: strip any extensions that might be passed in with the locale [ANDR-14]#330

Merged
Rafal Niski (rafalniski) merged 2 commits intomasterfrom
andr-14-strip-extensions-from-locale
Nov 11, 2025
Merged

fix: strip any extensions that might be passed in with the locale [ANDR-14]#330
Rafal Niski (rafalniski) merged 2 commits intomasterfrom
andr-14-strip-extensions-from-locale

Conversation

@elylucasctfl
Copy link
Contributor

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes locale handling to strip Unicode extension tags (e.g., "-u-fw-sun-mu-celsius") that Android 14+ includes in locale strings. Contentful's API doesn't support these extensions, so they need to be removed while preserving the base locale code (language, script, and region).

  • Added stripExtensionsFromLocale() method to normalize locale strings by removing Unicode extensions
  • Updated withLocale() to normalize locales before storing them
  • Added comprehensive test coverage for various locale formats including edge cases

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/main/java/com/contentful/java/cda/AbsQuery.java Implements locale normalization by stripping Unicode extensions using -u- as the separator
src/test/java/com/contentful/java/cda/AbsQueryTest.java Adds 11 test cases covering standard locales, Unicode extensions, edge cases, and locale format variations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Collaborator

@rafalniski Rafal Niski (rafalniski) left a comment

Choose a reason for hiding this comment

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

Good work!

@rafalniski Rafal Niski (rafalniski) merged commit 9e52649 into master Nov 11, 2025
5 checks passed
@rafalniski Rafal Niski (rafalniski) deleted the andr-14-strip-extensions-from-locale branch November 11, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants