Simply looking for the “best practice” on a minor issue I am running up against, using ColdFusion 9.0.2 with ColdBox 3.5.2.
We have a mobile gateway built supporting RESTful services. It is stateless. User authenticate to a proxy, and a token is passed in each request. This is validated and the user information is cached (CacheBox) for a short period of time (for performance reasons to handle multiple requests. This is all working well.
Recently I’ve set about to wire in the i18n plugin. This has gone well. The only snag is that our system actually has a database of languages supported, identified with a languageKey (UUID), and associated with a locale (e.g.: en_US, etc.). I’ve wrapped the i18n plugin with a language service which abstracts out the resolution of languageKey to locale. This is necessary as the application the gateway accesses is a reporting system which stores reports in multiple language identified with the languageKey.
On to the problem…
The handlers accept, where appropriate, a languageKey from the device, for some of the routes. Many of the queries, etc., then use the languageKey to translate information returned (e.g.: pick-lists, etc.) to be sent back to the device.
I’m trying to avoid passing the languageKey (UUID) to every service method. It is my understanding that the locale can be stored, as part of the request, using the setFwLocale(), but not sure what to do with the languageKey, which is necessary as well. I realize that I “could” store the languageKey in the RC/PRC, and access that from the service models, but not sure if that is a good idea.
Not sure I’m making the issue clear. If so, suggestions? If not, I can elaborate as needed.
Thanks in advance!
Kevin S. Anderson