You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by jo...@gmail.com on 2009/08/28 20:17:39 UTC

Re: Fix problem with loading i18n constants for RenderingGadgetRewritter

Thanks again for doing this Shaopeng! Comments provided.


http://codereview.appspot.com/109114/diff/2001/4
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/render/RenderingGadgetRewriter.java
(right):

http://codereview.appspot.com/109114/diff/2001/4#newcode61
Line 61: import java.io.File;
out of order

http://codereview.appspot.com/109114/diff/2001/4#newcode272
Line 272: }
As mentioned in our corresponding discussion thread, somewhat
duplicative as it is, this should be in a separate rewriter. In its
implementation, we should inject a separate <script> tag containing the
I18N constants to isolate their effects from other inline JS as a
defensive coding measure.

http://codereview.appspot.com/109114/diff/2001/4#newcode319
Line 319: File file = new File(dataPath +
"DateTimeConstants__localeName_" + locale.getCountry());
For less brittleness, let's use
org.apache.shindig.common.util.ResourceLoader. @see JsFeatureLoader.java
for an example of use. Because the features JARs are always loaded when
starting a given instance of the gadget server, you're guaranteed their
resources will be available.

In short, that changes new
File("features/target/classes/features/i18n/data/" + file) to:
String content = ResourceLoader.getContent(features/i18n/data/" _ file);

Sorry not to have noted this before.

http://codereview.appspot.com/109114