Shindig
  1. Shindig
  2. SHINDIG-1523

allow localizable params in feature specification

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0, 2.0.2, 2.5.0-beta1
    • Fix Version/s: 2.5.0
    • Component/s: Java
    • Labels:
    • Environment:
      All

      Description

      Allow the localization of feature parameters. This allows us to provide parameters that can be localized when the gadget definition is processed. In the example below, _MSG_mytest_ will get replaced with "Search" from the bundle. The localized XML inside the CDATA can then be consumed by the container.

      Sample gadget definition:

      <?xml version="1.0" encoding="UTF-8" ?>
      <Module>
      <ModulePrefs title="Hello" description="Message ">
      <Locale messages="messages.xml"/>

      <Require feature="dynamic-height" />
      <Require feature="setprefs" />
      <Optional feature="opensearch">
      <Param name="opensearch-description"><![CDATA[<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
      <ShortName>_MSG_mytest_</ShortName>
      <Description>Realtime Twitter Search</Description>
      <Url type="application/atom+xml" method="get" template="http://search.twitter.com/search.atom?q=

      {searchTerms}

      "/>
      <Image width="16" height="16">http://search.twitter.com/favicon.png</Image>
      <InputEncoding>UTF-8</InputEncoding>
      <SearchForm>http://search.twitter.com/</SearchForm>

      </OpenSearchDescription>]]></Param>
      </Optional>

      </ModulePrefs>

      <Content type="url" href="http://www.example.com/search/index.html" />
      </Module>

      Sample message bundle:
      <?xml version="1.0" encoding="UTF-8"?>
      <messagebundle>
      <msg name="mytest">
      Search
      </msg>
      </messagebundle>

      1. paramloc.txt
        4 kB
        Igor Belakovskiy

        Activity

        Igor Belakovskiy created issue -
        Hide
        Igor Belakovskiy added a comment -

        Changes to org.apache.shindig.gadgets.spec.Feature, and accompanying tests. This assumes that parameters are stored as objects, and not as strings. This allows serialized XML objects to be stored as JSON.

        Show
        Igor Belakovskiy added a comment - Changes to org.apache.shindig.gadgets.spec.Feature, and accompanying tests. This assumes that parameters are stored as objects, and not as strings. This allows serialized XML objects to be stored as JSON.
        Igor Belakovskiy made changes -
        Field Original Value New Value
        Attachment featurepatch04082010.txt [ 12476043 ]
        Hide
        Igor Belakovskiy added a comment -

        Spoke to Ziv Horesh, will be modifying patch to parse XML as string, and pass through as a string to the container, instead of passing it through as a JSON object. Conversion will occur on the container side.

        Show
        Igor Belakovskiy added a comment - Spoke to Ziv Horesh, will be modifying patch to parse XML as string, and pass through as a string to the container, instead of passing it through as a JSON object. Conversion will occur on the container side.
        Igor Belakovskiy made changes -
        Fix Version/s 3.0.0 [ 12315324 ]
        Igor Belakovskiy made changes -
        Affects Version/s 3.0.0 [ 12315324 ]
        Igor Belakovskiy made changes -
        Attachment featurepatch04212011.txt [ 12477024 ]
        Hide
        Igor Belakovskiy added a comment -

        Incorporated the latest round of Ziv's comments.

        Show
        Igor Belakovskiy added a comment - Incorporated the latest round of Ziv's comments.
        Igor Belakovskiy made changes -
        Attachment feature04282011.txt [ 12477680 ]
        Igor Belakovskiy made changes -
        Summary allow declarative parameters in feature specification allow localizable params in feature specification
        Description Allow the addition of arbitrary XML inside of the feature param tags. This allows the feature to specify complex objects as parameters that can be returned as JSON as part of the gadget metadata, and be used by the common container.

        <?xml version="1.0" encoding="UTF-8"?>
        <Module>
        <ModulePrefs title="Sample VOIP">
          <Optional feature="actions">
         <Param name="action-contributions">
           <action id="org.samplevoip.callbyperson" dataObject="opensocial.Person" label="Call using VOIP Phone" view="DialByPerson" icon="http://ww.samplervoip.org/phone.gif"/>
           <action id="org.samplervoip.navLink" path="container/navigationLinks" label="Phone" />
        </Param>
        </Optional>
          </ModulePrefs>
        <Content type="html"><![CDATA[
        <h2>Test</h2>
        ]]></Content>
        </Module>

        JSON Representation of above parameters.

        {"params":{"action-contributions":[
                                                       {"action":{"label":"Call using VOIP Phone","view":"DialByPerson","icon":"http://ww.samplervoip.org/phone.gif","dataObject":"opensocial.Person","id":"org.samplevoip.callbyperson"}},
                                                       {"action":{"label":"Phone","path":"container/navigationLinks","id":"org.samplervoip.navLink"}}
        ]}
        Allow the localization of feature parameters. This allows us to provide parameters that can be localized when the gadget definition is processed. In the example below, __MSG_mytest__ will get replaced with "Search" from the bundle. The localized XML inside the CDATA can then be consumed by the container.


        <?xml version="1.0" encoding="UTF-8" ?>
        <Module>
          <ModulePrefs title="Hello" description="Message ">
          <Locale messages="messages.xml"/>
          
          <Require feature="dynamic-height" />
          <Require feature="setprefs" />
            <Optional feature="opensearch">
          <Param name="opensearch-description"><![CDATA[<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
          <ShortName>__MSG_mytest__</ShortName>
          <Description>Realtime Twitter Search</Description>
          <Url type="application/atom+xml" method="get" template="http://search.twitter.com/search.atom?q={searchTerms}"/>
          <Image width="16" height="16">http://search.twitter.com/favicon.png&lt;/Image>
          <InputEncoding>UTF-8</InputEncoding>
          <SearchForm>http://search.twitter.com/&lt;/SearchForm>

        </OpenSearchDescription>]]></Param>
         </Optional>

          </ModulePrefs>

          <Content type="url" href="http://www.example.com/search/index.html" />
        </Module>

        <?xml version="1.0" encoding="UTF-8"?>
        <messagebundle>

          <msg name="mytest">
            Search
          </msg>


        </messagebundle>












        Igor Belakovskiy made changes -
        Attachment feature04282011.txt [ 12477680 ]
        Igor Belakovskiy made changes -
        Attachment featurepatch04082010.txt [ 12476043 ]
        Igor Belakovskiy made changes -
        Attachment featurepatch04212011.txt [ 12477024 ]
        Hide
        Igor Belakovskiy added a comment -

        Allow localization of feature params. Adds substitution to module prefs and a setter to the feature class.

        Show
        Igor Belakovskiy added a comment - Allow localization of feature params. Adds substitution to module prefs and a setter to the feature class.
        Igor Belakovskiy made changes -
        Attachment featureparams04282011.txt [ 12477681 ]
        Igor Belakovskiy made changes -
        Description Allow the localization of feature parameters. This allows us to provide parameters that can be localized when the gadget definition is processed. In the example below, __MSG_mytest__ will get replaced with "Search" from the bundle. The localized XML inside the CDATA can then be consumed by the container.


        <?xml version="1.0" encoding="UTF-8" ?>
        <Module>
          <ModulePrefs title="Hello" description="Message ">
          <Locale messages="messages.xml"/>
          
          <Require feature="dynamic-height" />
          <Require feature="setprefs" />
            <Optional feature="opensearch">
          <Param name="opensearch-description"><![CDATA[<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
          <ShortName>__MSG_mytest__</ShortName>
          <Description>Realtime Twitter Search</Description>
          <Url type="application/atom+xml" method="get" template="http://search.twitter.com/search.atom?q={searchTerms}"/>
          <Image width="16" height="16">http://search.twitter.com/favicon.png&lt;/Image>
          <InputEncoding>UTF-8</InputEncoding>
          <SearchForm>http://search.twitter.com/&lt;/SearchForm>

        </OpenSearchDescription>]]></Param>
         </Optional>

          </ModulePrefs>

          <Content type="url" href="http://www.example.com/search/index.html" />
        </Module>

        <?xml version="1.0" encoding="UTF-8"?>
        <messagebundle>

          <msg name="mytest">
            Search
          </msg>


        </messagebundle>












        Allow the localization of feature parameters. This allows us to provide parameters that can be localized when the gadget definition is processed. In the example below, __MSG_mytest__ will get replaced with "Search" from the bundle. The localized XML inside the CDATA can then be consumed by the container.


        <?xml version="1.0" encoding="UTF-8" ?>
        <Module>
          <ModulePrefs title="Hello" description="Message ">
          <Locale messages="messages.xml"/>
          
          <Require feature="dynamic-height" />
          <Require feature="setprefs" />
            <Optional feature="opensearch">
          <Param name="opensearch-description"><![CDATA[<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
          <ShortName>__MSG_mytest__</ShortName>
          <Description>Realtime Twitter Search</Description>
          <Url type="application/atom+xml" method="get" template="http://search.twitter.com/search.atom?q={searchTerms}"/>
          <Image width="16" height="16">http://search.twitter.com/favicon.png&lt;/Image>
          <InputEncoding>UTF-8</InputEncoding>
          <SearchForm>http://search.twitter.com/&lt;/SearchForm>

        </OpenSearchDescription>]]></Param>
         </Optional>

          </ModulePrefs>

          <Content type="url" href="http://www.example.com/search/index.html" />
        </Module>

        <?xml version="1.0" encoding="UTF-8"?>
        <messagebundle>

          <msg name="mytest">
            Search
          </msg>


        </messagebundle>
        Igor Belakovskiy made changes -
        Description Allow the localization of feature parameters. This allows us to provide parameters that can be localized when the gadget definition is processed. In the example below, __MSG_mytest__ will get replaced with "Search" from the bundle. The localized XML inside the CDATA can then be consumed by the container.


        <?xml version="1.0" encoding="UTF-8" ?>
        <Module>
          <ModulePrefs title="Hello" description="Message ">
          <Locale messages="messages.xml"/>
          
          <Require feature="dynamic-height" />
          <Require feature="setprefs" />
            <Optional feature="opensearch">
          <Param name="opensearch-description"><![CDATA[<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
          <ShortName>__MSG_mytest__</ShortName>
          <Description>Realtime Twitter Search</Description>
          <Url type="application/atom+xml" method="get" template="http://search.twitter.com/search.atom?q={searchTerms}"/>
          <Image width="16" height="16">http://search.twitter.com/favicon.png&lt;/Image>
          <InputEncoding>UTF-8</InputEncoding>
          <SearchForm>http://search.twitter.com/&lt;/SearchForm>

        </OpenSearchDescription>]]></Param>
         </Optional>

          </ModulePrefs>

          <Content type="url" href="http://www.example.com/search/index.html" />
        </Module>

        <?xml version="1.0" encoding="UTF-8"?>
        <messagebundle>

          <msg name="mytest">
            Search
          </msg>


        </messagebundle>
        Allow the localization of feature parameters. This allows us to provide parameters that can be localized when the gadget definition is processed. In the example below, __MSG_mytest__ will get replaced with "Search" from the bundle. The localized XML inside the CDATA can then be consumed by the container.

        Sample gadget definition:

        <?xml version="1.0" encoding="UTF-8" ?>
        <Module>
          <ModulePrefs title="Hello" description="Message ">
          <Locale messages="messages.xml"/>
          
          <Require feature="dynamic-height" />
          <Require feature="setprefs" />
            <Optional feature="opensearch">
          <Param name="opensearch-description"><![CDATA[<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
          <ShortName>__MSG_mytest__</ShortName>
          <Description>Realtime Twitter Search</Description>
          <Url type="application/atom+xml" method="get" template="http://search.twitter.com/search.atom?q={searchTerms}"/>
          <Image width="16" height="16">http://search.twitter.com/favicon.png&lt;/Image>
          <InputEncoding>UTF-8</InputEncoding>
          <SearchForm>http://search.twitter.com/&lt;/SearchForm>

        </OpenSearchDescription>]]></Param>
         </Optional>

          </ModulePrefs>

          <Content type="url" href="http://www.example.com/search/index.html" />
        </Module>


        Sample message bundle:
        <?xml version="1.0" encoding="UTF-8"?>
        <messagebundle>
          <msg name="mytest">
            Search
          </msg>
        </messagebundle>
        Labels Enhancement Feature Enhancement
        Igor Belakovskiy made changes -
        Attachment featureparams04282011.txt [ 12477681 ]
        Igor Belakovskiy made changes -
        Attachment paramloc.txt [ 12478193 ]
        Gavin made changes -
        Workflow jira [ 12610232 ] patch-available, re-open possible [ 12630011 ]
        Paul Lindner made changes -
        Fix Version/s 2.0.0 [ 12314100 ]
        Fix Version/s 2.0.2 [ 12315354 ]
        Paul Lindner made changes -
        Fix Version/s 2.5.0 [ 12320364 ]
        Fix Version/s 2.5.0-beta1 [ 12315324 ]
        Hide
        Ryan Baxter added a comment -

        Looks like this was already fixed

        Show
        Ryan Baxter added a comment - Looks like this was already fixed
        Ryan Baxter made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Igor Belakovskiy
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development