Skip to content

feat(WL-572): introduces new locale format - #34

Merged
nayaradias merged 2 commits into
mainfrom
feat/WL-572
Oct 15, 2026
Merged

nayaradias merged 2 commits into
mainfrom
feat/WL-572

Conversation

@DanielAraldi

Copy link
Copy Markdown
Contributor

📝 Summary

This PR introduces a new locale format. Translations now live in JavaScript as typed Locale objects, not in native resource files.

Before this change, setLocale took a language code ('pt-BR', 'es', ...). Native code then loaded the matching facetec-strings.xml (Android) or FaceTec-<lang>.strings (iOS) file. setDynamicStrings and resetDynamicStrings changed the strings separately. Two APIs controlled the same UI text, and both platforms carried 13 copies of the translation files.

Now setLocale receives a Locale object. The library exports a complete object for each supported language: af, ar, de, el, en, es, fr, ja, kk, nb, ptBR, ru, vi and zh. To customize strings, spread one of these objects and override the strings you want to change. Calling setLocale() without arguments resets the strings to en. Internally, setLocale forwards the object to the native setDynamicStrings method.

import { setLocale, ptBR } from '@azify/aziface-mobile';

setLocale(ptBR);

setLocale({
  ...ptBR,
  action: { ...ptBR.action, ok: 'Vamos lá!' },
});

💥 What was changed?

Before After
setLocale('pt-BR') setLocale(ptBR)
setLocale('default') setLocale() or setLocale(en)
setDynamicStrings(strings) setLocale({ ...en, ...strings })
resetDynamicStrings() setLocale()
type Locale (union of language codes) interface Locale (strings object)
DynamicStrings* interfaces Renamed to Locale* (e.g. LocaleAction)

✅ Checklist

⚠️ Impact

  • Low (isolated change)
  • Medium (affects multiple areas)
  • High (critical flow / risk of regression)

Public API change: setLocale signature changed, and setDynamicStrings, resetDynamicStrings and the DynamicStrings types were removed. Consumers must migrate (see table above).

📱 React Native

  • Added src/locales/ with one typed Required<Locale> object per language, exported from the package root.
  • Replaced the Locale code union with the Locale strings interface; renamed all DynamicStrings* interfaces to Locale*.
  • setLocale(locale?: Locale) now sends the object to native setDynamicStrings, with en as fallback.
  • Removed setDynamicStrings and resetDynamicStrings from the public API and setLocale / resetDynamicStrings from the TurboModule spec (NativeAzifaceMobile.ts).
  • Updated example and examples/expoapp to the new API (new LocaleType type, LOCALES map of locale objects).
  • examples/expoapp now depends on @azify/aziface-mobile@*.
  • Excluded examples from tsconfig.build.json.
  • Updated README.md and docs/DYNAMIC_STRINGS.md.

🤖 Android

  • Removed setLocale, resetDynamicStrings and setupI18n from AzifaceMobileModule.java.
  • Removed i18n/Localization.java.
  • Removed the 13 values-<lang>/facetec-strings.xml resource files.

🍎 iOS

  • Removed setLocale, resetDynamicStrings and setupI18n from Aziface.swift and AzifaceMobile.mm.
  • Removed I18n/Localization.swift.
  • Removed the 13 FaceTec-<lang>.strings files.
  • Updated example/ios/Podfile.lock.

🧪 Testing Notes

  1. Run the example or examples/expoapp app and initialize the SDK.
  2. Tap the locale button to cycle languages, then start a flow (e.g. liveness). Check that the UI text matches the selected language.
  3. Tap the reset button. Check that the text returns to English.
  4. Tap Others Strings (custom strings). Check that the overridden strings appear in the session.
  5. Repeat on both platforms.
  • Tested on Android (device/emulator)
  • Tested on iOS (simulator/device)
  • Automated tests added/updated
  • QA passed

🔗 Related Issues / Tickets

  • Related to WL-572

📸 Evidence (Optional)

  • Screenshot 1: Before/After

⚠️ Notes for Reviewers (Optional)

  • The native setDynamicStrings method is unchanged; it is now the only path for setting UI text.
  • Most of the diff is deleted native translation files (Android XML and iOS .strings) and the new src/locales/*.ts files.
  • The example and examples/expoapp apps keep a local LocaleType union for their language picker. The library no longer exports a language-code type.

@DanielAraldi DanielAraldi self-assigned this Oct 13, 2026
@DanielAraldi DanielAraldi added the documentation Improvements or additions to documentation label Oct 13, 2026
@DanielAraldi DanielAraldi added duplicate This issue or pull request already exists enhancement New feature or request labels Oct 13, 2026
@DanielAraldi
DanielAraldi marked this pull request as draft October 13, 2026 13:59
@DanielAraldi
DanielAraldi marked this pull request as ready for review October 13, 2026 18:10
@nayaradias
nayaradias merged commit b9eceac into main Oct 15, 2026
1 check passed
@nayaradias
nayaradias deleted the feat/WL-572 branch October 15, 2026 13:07
@nayaradias

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nayaradias nayaradias added the released Version released label Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request released Version released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants