✅ 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"


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 |


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.
Was this page helpful?