Link Inlining Optimization for Android
Article Summary
Alex Dadukin from Just Eat Takeaway reveals how inline links in Android apps create a localization nightmare. Their team evaluated three common approaches and found them all fundamentally broken.
Just Eat Takeaway's Android team tackled the messy problem of clickable text links embedded in localized strings (think privacy policies and terms). After auditing their fragmented implementations, they discovered each approach had critical flaws around translation accuracy, code complexity, and maintainability.
Key Takeaways
- String concatenation approach requires 2n+1 separate resources for n links
- Substring matching breaks with duplicate text or mistranslations
- HTML syntax embeds URLs directly, blocking custom deeplink actions
- Markdown-like syntax with IDs enables link-agnostic, linear-time parsing
- New approach separates link identifiers from URLs for better localization
A custom Markdown-inspired syntax solves Android inline link localization by using identifiers instead of hardcoded URLs, reducing cognitive load while supporting arbitrary styling and custom click actions.
About This Article
Just Eat Takeaway's Android team struggled with cognitive load from inline links. Each set of n links required between n and 2n+1 separate string resources, and translations often got mixed up across different grammatical variations.
Alex Dadukin's team switched to a Markdown-like syntax that uses identifiers instead of URLs. This enabled a stack-based parsing algorithm with linear time complexity, which kept link interpretation separate from the localized string.
The team no longer needed extra translatable resources. The approach also supported arbitrary styling, custom intents, and deeplinks as a single pre-processing step that integrated into existing design libraries.