A different way, that skips coders, is the following:
Define some new items in your json file:
items: [
{label: "First kind",
number: "1"},
{label: "Second kind",
number: "2"},
etc.
]
then, assuming you have items with a "kind" property, just make a
<div ex:role="facet" ex:expression=".kind!number"></div> and the words
will show up in the facet.
David Huynh wrote:
> polyboom wrote:
>
>> Hey everybody,
>>
>> maybe someone can help me with the following plan:
>>
>> i would like to translate some values of my json into words e.g.: "1"
>> -- > "public"
>>
>> on http://simile.mit.edu/wiki/Exhibit/2.0/Coders
>> No. 5 talks about translating those values with the kind property
>> value ... "from the kind property value of 1 to to the text "First
>> kind"? [question] "
>>
>> I can't find any example how to do this .
>>
>> The next part of this plan is to translate values for facets e.g.:
>> instead of a boring number there shall be a word in the facet ...
>>
>> is this possible? If so i would be very thankful!!!
>>
>>
> Actually the #5 example was never implemented, but you can use a
> different mechanism for what you want. After including exhibit-api.js,
> add this JS code
>
> <script>
> Exhibit.FunctionUtilities.registerSimpleMappingFunction(
> "my-translate",
> function(n) {
> return "public"; // or whatever, depending on n
> },
> "text"
> );
> </script>
>
> Then define your facet like so
>
> <div ex:role="facet" ex:expression="my-translate(.someProperty)"></div>
>
> where someProperty is the property to translate.
>
> David
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---