Hi Cheranthian,
I have pushed a small example on
wro4j-examples, which is a proof of concept for your use-case.
The assumption is that you have a servlet responsible for serving translated resources in JSON format, based on defined list of properties. In the example project, there is a
TranslationServlet which mocks your implementation (it just returns a json which differs based on resolved locale).
The most important part is the customization of the
WroManagerFactory, which extends the CacheKeyFactory. This implementation ensure that the wro generated resources are not cached only by its name, but also will take into account the request resolved locale.
When requesting the same url (/wro/g1.js) for different locales (it can be simulated by adding ?locale=FR to the request path), you'll notice that the served response is different.This approach is similar to defining new group for each locale, but the same result is achieved using a single group. You will probably want to limit the number of supported locales, to avoid explosion of cached groups.
I hope this example can help you to solve your problem.
If you have any questions, don't hesitate to ask.
Cheers,
Alex