Skip to content

test(fingerprint): cover the reported device language - #12

Merged
onamfc merged 1 commit into
mainfrom
test/fingerprint-language
Oct 20, 2026
Merged

onamfc merged 1 commit into
mainfrom
test/fingerprint-language

Conversation

@onamfc

@onamfc onamfc commented Oct 20, 2026

Copy link
Copy Markdown
Member

Summary

The fingerprint's language is language or language-REGION, the same form the other SDKs and the server use. This adds tests for it.

  • FingerprintCollector.languageTag(Locale) (@visibleForTesting) holds the formatting that _getLanguage() did inline; behavior is unchanged.
  • Tests:
    • en-US, en, en-ES, es-419 and fil-PH are reported as they are.
    • Script subtags are dropped: zh_Hans_CN → zh-CN, zh_Hant_TW → zh-TW, sr_Latn_RS → sr-RS, zh_Hans → zh.
    • An empty country code reports the language alone.
    • Every value is at most 10 characters and matches ll[-RR].
    • The value is read from the platform dispatcher's locale (localeTestValue).

The engine hands the locale over already split into language, script and country, without Android's -u-… extensions or iOS's @ keywords, so those can't reach the fingerprint.

Tests

flutter test: 125 passed. flutter analyze: no issues. dart format --set-exit-if-changed: clean.

Moves the formatting of the device locale into FingerprintCollector.languageTag
and tests it: language or language-REGION, script subtags dropped, 3-digit
regions kept, at most 10 characters, and read from the platform dispatcher.
@onamfc
onamfc merged commit ccfda07 into main Oct 20, 2026
4 checks passed
@onamfc
onamfc deleted the test/fingerprint-language branch October 20, 2026 02:35
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.

1 participant