Skip to content

fix(fingerprint): send the device language as language-region - #8

Merged
onamfc merged 3 commits into
mainfrom
fix/language-region
Oct 19, 2026
Merged

onamfc merged 3 commits into
mainfrom
fix/language-region

Conversation

@onamfc

@onamfc onamfc commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Summary

The SDK sends the device language as language or language-REGION, whatever form the platform reports it in.

FingerprintCollector.getLanguage() reads iOS SettingsManager (AppleLocale / AppleLanguages[0]), Android I18nManager.localeIdentifier, or navigator.language. Those come in several shapes, and the new normalizeLanguageTag (src/languageTag.ts) reduces each to the same form:

Reported Sent
en_ES_#u-fw-mon-mu-celsius (Java Locale.toString(), regional preferences set) en-ES
en-ES-u-fw-mon-mu-celsius (BCP 47 with extensions) en-ES
zh_CN_#Hans, zh-Hans-CN zh-CN
en_GB@rg=eszzzz, en_US@calendar=japanese (Apple identifiers with keywords) en-GB, en-US
en_US.UTF-8 en-US
es-419, fil_PH, en es-419, fil-PH, en

Script, variant, extension and keyword parts are dropped. A value that doesn't start with a 2–3 letter language moves on to the next source, then en-US. This is the same form the browser side of a click reports, and the same normalization the LinkForty server applies.

The install request, the fp_lang parameter on a direct open, and the fingerprint query string all read the language from FingerprintCollector.collect(), so all three send the normalized value.

CI

  • .github/workflows/test.yml builds the package and runs the Vitest suite on every pull request and push to main.
  • .github/workflows/release.yml runs the suite after the build and before semantic-release, so a release is only published when the tests pass.

Tests

__tests__/languageTag.test.ts: every shape above, plus junk and non-string input. Locally npm run build is clean and npm test passes 53 tests in 4 files.

The device locale is reported as a BCP 47 tag, a Java Locale.toString()
string (I18nManager on Android, e.g. en_ES_#u-fw-mon-mu-celsius) or an
Apple identifier with keywords (en_GB@rg=eszzzz). The SDK now reduces
whichever source it reads to language or language-REGION (en-ES, en-GB,
zh-CN, es-419), the same form the browser side of a click reports.
@onamfc
onamfc merged commit 7c0569e into main Oct 19, 2026
1 check passed
github-actions Bot pushed a commit that referenced this pull request Oct 19, 2026
## <small>1.6.2 (2026-10-19)</small>

* fix(fingerprint): send the device language as language-region (#8) ([7c0569e](7c0569e)), closes [#8](#8) [en_ES_#u-fw-mon-mu-celsius](https://github.com/en_ES_/issues/u-fw-mon-mu-celsius)
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.6.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant