Gabber currently supports six languages, and chooses the language based on the preference of the users device. All mobile and web content is stored in string resources, however, as content about a project is dynamic, it does not currently change depending on language set, such as the users preferred language. To support such a change, we must remodel how projects and topics are stored and delivered through the API.
Storing
Currently, a project can have many topics (one-to-many), however, to support multiple languages we must abstract the project content (description, title, slug) and topics text to two other tables (as illustrated below); a project has many project_languages
, and a project has many topic_languages
.
project_languages
ID |
ProjectID (FK) |
LanguageID |
Description |
Title |
Slug |
0 |
12 |
0 |
How beer shapes thinking |
Beer with me |
beer-with-me |
1 |
12 |
1 |
come la birra plasma il pensiero |
pensano Birra con me |
birra con me |
2 |
0 |
0 |
How do you do, my name is Sue |
Music from the ages |
music-from-ages |
topic_languages
ID |
ProjectID (FK) |
LanguageID |
text |
0 |
12 |
0 |
The good |
1 |
12 |
1 |
The bad |
2 |
0 |
0 |
The ugly |
Output from API
Now we have changed how a project is represented, anywhere that returns a project must be revisited, and fundamental to this is creating and updating a project. This will require updating the ProjectSchema's to return all written content (title, description, topics) contained in a content
dictionary where each item has a key representing by a language code (en, ru, it) that can be used to lookup the relevant content.
(The creation of this feature is blocked by #2 and will ensure Mobile#11 is possible)