I do not know if there is a ready solution that meets and gives you one really would be a very broad answer. I can give you a solution in general terms, something that I have used in my solutions.
It may even work, but power and flexibility work. The solution is to create your localization infrastructure (the correct term in this case).
Everyone is accustomed to always having libraries and ready-made frameworks that solve everything. We use these solutions so much that sometimes we forget that someone had to do that. If you need something that does not meet you, and this happens more often than not, you have two solutions: give up some requirement or create a solution of your own.
The solution itself does not need to start from scratch, you can take advantage of something already in place to adapt.
You can create a collection of functions very similar to what you have ready, but the moment you pick up the strings required for each language, the data source is changed. If you were in resources of Windows or Java either in JSON or XML file or flat file , would now be in a database. A very flexible library should even be able to swap the data source almost transparently.
In theory, it does not matter where you are using it. Good localization technology should be able to be used under any circumstances.
A cache system is always welcome in cases like this to avoid querying the database every time.
If you want to have an external data source, if you want to allow its exchange you need to create the appropriate infrastructure for this. I gave you the solution to what you asked for. If you can do it otherwise, without external data, do it.