Hi Shaopeng:
As I see it, there are two ways to implement this that fit with current
Shindig extension style. The main issue w/ the patch you've implemented is
that it embeds feature-sensitivity into a core piece of rendering logic. We
can use one of the existing mechanisms:

1) feature.xml and the JsLibrary/JsFeatureLoader/GadgetFeature system. We've
been considering the addition of language and country-sensitivity to this
mechanism for some time, and this might be the right place to do it. The net
result would be a feature.xml including blocks such as:
<gadget lang="en" country="us">
  <script src="data/DateTimeConstants_en_us.js"/>
  <script src="..."/>

This implementation approach is generic and reusable, both reasons I prefer
it, assuming this would work for the i18n library (perhaps you can say as
well as I; a perusal of the DateTimeConstants*.js files doesn't appear to
map cleanly to lang/country... is there other selection logic needed?). It
involves changes to GadgetFeature.java, JsFeatureLoader.java,
JsLibrary.java, and obviously i18n/feature.xml.

2) A GadgetRewriter. Essentially, write an OpensocialI18nGadgetRewriter
implementing GadgetRewriter, which does:
  - Loads data/DateTimeConstants*.js files.
  - In rewriter, injects the appropriate DTC.js when the gadget's features
include "opensocial-i18n".

Thoughts? Other Shindig folks?

--John

On Wed, Aug 26, 2009 at 12:41 AM, Shaopeng Jia (贾少鹏) <[email protected]
> wrote:

> Hi shindig-dev,
> As per this bug:
>
> https://issues.apache.org/jira/browse/SHINDIG-1159
>
>  <https://issues.apache.org/jira/browse/SHINDIG-1159>it seems
> gadgets.i18n.DateTimeConstants.js are not outputted during rendering. I did
> some investigation and located the problem is at
>
>
> java/gadgets/src/main/java/org/apache/shindig/gadgets/render/RenderingContentRewriter.java
>
> I have attached a diff which illustrate how to fix the bug, but it is
> loading the DateTimeConstants from my local directory right now. Is there a
> way to get the location of the feature directory on the fly? Or there are
> better ways to load the js code?
>
> Thanks,
>
> Shaopeng
>
>
> --
> Shaopeng Jia
> 贾少鹏
> Software Engineer - Îñţérñåţîöñåļîžåţîöñ
> Google Switzerland GmbH |Identifikationsnummer: CH-020.4.028.116-1
>

Reply via email to