✅ Software architecture for front-end translations

I've an .NET 7 Blazor WebAssembly Hosted web application meant to be deployed in a industrial environment local network and to be used by as few as 5 users simultaneously. Since at the factory there can be workers speaking different languages, and since we can connect via VPN for maintenance, I need to include a translation mechanism, which should involve all the front-end writings. As of now I've setup some .cs files containing constants fields representing symbols. Example:

public string CAMERA_CONNECTION_LOST = "camera_connection_lost"

public string CAMERA_CONNECTION_LOST = "camera_connection_lost"
Then, in the database I'll have a "transl" table structured like this

--------------------------------------------------------
| symbol | lang | translation |
--------------------------------------------------------
| camera_connection_lost | en_us | Connection lost |
| camera_connection_lost | it_it | Connessione persa |

--------------------------------------------------------
| symbol | lang | translation |
--------------------------------------------------------
| camera_connection_lost | en_us | Connection lost |
| camera_connection_lost | it_it | Connessione persa |
And so on. When an use launch the blazor application, blazor could 1) Retrieve from back-end translations for all the symbols defined in the web application (larger loading time at startup, larger memory usage, lower latency when navigating to another page of the application since no need to request translation for that specific page) 2) Retrieve from back-end translations for the symbols of a given page (maybe I should have a "page" table (representing a Blazor page) and an M-to-M relationship between pages and symbols. What do you think of this approach? What bothers me of this approach is to have the symbols hard-coded in the program. I'm not sure if that's acceptable or not.
4 Replies
canton7
canton73y ago
ASP.NET Core Blazor globalization and localization
Learn how to render globalized and localized content to users in different cultures and languages.
alkasel#159
alkasel#159OP3y ago
Because I like to be in control 😛 . But if you say there is a good tool already in place, I'll take a look at that, that is probably better than mine, thanks! I was able to setup a translation system based on your suggestions. It is actually much simpler than mine to work with and mantain! thank you very much for encouraging me to make the right thing 👍
canton7
canton73y ago
Awesome!
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server