Localization & Multi-Tenancy Support for Esports Website
Overview
At the outset of this project, the esports website GosuGamers only had a global website in English and wanted to expand to new markets. The goal was to deploy the website on multiple domains, with support for different languages and selections of content, for example, regional tournaments.
The biggest challenge was that it was not a pure multi-tenancy situation; some content would be shared, some would be site-specific, and some would be conditionally shown.
My responsibility was to implement the back-end aspects which included tasks such as:
- Discussing desired behavior and technical trade-offs with the project manager and the other developers
- Setting up a performant database schema that allowed content to be either assigned to specific locales or have only specific fields translated
- Implementing API support for managing translations of content and email/push notification templates via our admin panel
- Implementing API support for retrieving a filtered list of content (articles, tournaments, etc.) in the correct language There were a few different components to this project, and I'll briefly describe each of them.
Below are some more details about the different components of this project.
Content Filtering
Selected types of content (articles, tournaments, etc.) had the option to be assigned to one site, as well as a locale. As API requests came in for this content, we would dynamically add filters to the retrieved data based on the active site.
Some content would be optionally filtered (controlled via query parameters sent to the API), and other content would not be filtered at all.
Content Translations
While some content could have duplicates in other locales, other data was structural or historical in nature and could absolutely not be duplicated. For the latter, we implemented a system for translating specific fields only. An example of this was tournaments, where we would allow translations of the title, description, etc. but the match data would not be affected.
We added support that allowed administrators to easily see the translation status for a given content item, including whether each field had been translated, or translated but the English version had since been updated, or not translated at all.
Notification Translations
We added support for translating email and push notifications with ICU templates. Each template would receive global and type-specific variables with data such as usernames, localized team/player/tournament names, etc. which gave the administrators great flexibility to tweak the user communication without needing to involve developers.
API Support
All of the above functionality was exposed into our pre-existing API such that very few changes had to be made on the consuming side. They would pass the current site as an HTTP header, and the response would be localized and filtered automatically. For a few endpoints where the filtering would be conditional based on the context, the client could control this via a query parameter.