So you want to localize and internationalize your web application? There are a lot of considerations, but here, we briefly discuss just the translation part.
This post covers a couple of the architectural/design options and discusses their respective trade-offs. While this is a bit specific to .NET, other languages no doubt provide similar concepts, with various levels of API support (e.g. language stored in cookies)
.NET and .NET Core provide some infrastructure called "resource files" (.resx
) extension). These are XML files which you can edit directly in Visual Studio; at runtime, they compile down to a binary format. They generally recommend creating a few resource files (one per back-end controller or shared module). Advantages of this approach include:
The disadvantages of this format include:
Overall, I think this approach works well if you plan to update translations periodically and don't need an external translater. (If you do, and they're not a coder, you'll need to make additional tooling to export/import the strings in a format they can understand.)
One common alternative approach is to store the translations in a database (relational or otherwise) and simply load/display them at runtime. This confers some additional advantages over resource files:
However, it contains some additional downsides:
I think this approach suits situations where you absolutely must be able to see updated translations reflected immediately, or where you have non-technical translators who need an easy way to be able to update translations.
If you know of any other architectures/designs, drop me a note on Twitter and let me know!
Liked our updates? Subscribe to our newsletter to get access to our game demos and exclusive insider updates!