[ckan-dev] RE : CKAN API and multilingual tags

David Raznick kindly at gmail.com
Wed May 16 09:38:50 UTC 2012


Hello

I have made a quick example of an extension that adds for_view into the
context when calling an action api function.

https://gist.github.com/9f19fcda5871321335ec

It is completely untested but should be correct (may have typos).  It will
only work on the api call to api/action/vocabulary_show.

Thanks

David

On Wed, May 16, 2012 at 9:01 AM, VENTURA Oceane <OCEANE.VENTURA at atos.net>wrote:

>  Hi,
>
>  I insert the translations using the function
> logic.get_action('term_translation_update_many') with a CKAN command.
>
>  Now, the tags are translated into only one language. Maybe we can use
> the langage available in the called url ? (For example
> http://thedatahub.org/en/api/1 : English)
>
>  I'm using this AJAX call in my own custom extension, which modify the
> Dataset Form, to collect tags dynamically and show it in this form.
>
>  Thanks,
>
>
> *Océane VENTURA*
>  Business Development & Innovation
>  ATOS - Public Sector France
>  *oceane.ventura at atos.net*
>  River Ouest,
>  80 quai Voltaire
>  95 877 Bezons Cedex
>  www.atos.net
>
>
>   ------------------------------
> *De :* ckan-dev-bounces at lists.okfn.org [ckan-dev-bounces at lists.okfn.org]
> de la part de David Raznick [kindly at gmail.com]
> *Date d'envoi :* mardi 15 mai 2012 18:20
> *À :* CKAN Development Discussions
> *Objet :* Re: [ckan-dev] CKAN API and multilingual tags
>
>  Hello,
>
> You are correct, I am afraid the api does not currently translate the
> metadata at the moment.
>
> The reason for this was that was the api is mainly used to process the
> data rather than display it.  Data got from the api is supposed to be the
> same data that is put back into the api and that is why we did not decide
> to translate it.
>
> This is a relatively new feature, so it would be good to get your feedback
> on your usage.
>
> How did you insert the translations?
>
> How are you expecting to select a language for the tags to be translated
> to?  (this was another point as to why we did not decide to translate
> through the api)
>
> Do you have your own custom extension that your are using with your
> instance?
> (There may be a possible workaround if you are)
>
> Thanks
>
> David
>
>
>
>
> On Tue, May 15, 2012 at 4:41 PM, VENTURA Oceane <OCEANE.VENTURA at atos.net>wrote:
>
>>  Hi,
>>
>> I'm trying to use the CKAN API to collect tags of an existing vocabulary
>> thanks to an AJAX call.
>> When I use the function vocabulary_show (version 3 of the API), tags
>> aren't translated by the multilingual_tag module.
>> In fact, it's seems that when i'm using the API, the context doesn't have
>> the "for_view" attribute (used by the model_dictize for activate the
>> translation).
>>
>> What can I do to get translated tags from the API?
>>
>>  Thanks,
>>
>> *Océane VENTURA*
>> Business Development & Innovation
>> ATOS - Public Sector France
>>  *oceane.ventura at atos.net*
>> River Ouest,
>> 80 quai Voltaire
>> 95 877 Bezons Cedex
>> www.atos.net
>>
>>
>>   ------------------------------
>>
>> Ce message et les pièces jointes sont confidentiels et réservés à l'usage
>> exclusif de ses destinataires. Il peut également être protégé par le secret
>> professionnel. Si vous recevez ce message par erreur, merci d'en avertir
>> immédiatement l'expéditeur et de le détruire. L'intégrité du message ne
>> pouvant être assurée sur Internet, la responsabilité du groupe Atos ne
>> pourra être engagée quant au contenu de ce message. Bien que les meilleurs
>> efforts soient faits pour maintenir cette transmission exempte de tout
>> virus, l'expéditeur ne donne aucune garantie à cet égard et sa
>> responsabilité ne saurait être engagée pour tout dommage résultant d'un
>> virus transmis.
>>
>> This e-mail and the documents attached are confidential and intended
>> solely for the addressee; it may also be privileged. If you receive this
>> e-mail in error, please notify the sender immediately and destroy it. As
>> its integrity cannot be secured on the Internet, the Atos group liability
>> cannot be triggered for the message content. Although the sender endeavors
>> to maintain a computer virus-free network, the sender does not warrant that
>> this transmission is virus-free and will not be liable for any damages
>> resulting from any virus transmitted.
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>>
>>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120516/184120d6/attachment-0002.html>


More information about the ckan-dev mailing list