Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Transvision 2.5 JSON format

4 views
Skip to first unread message

Ricardo Palomares Martí­nez

unread,
May 25, 2013, 6:48:41 PM5/25/13
to
Hi,

I'm having problems getting Transvision 2.5 response in JSON format.
I'm using this URL:

http://transvision.mozfr.org/?sourcelocale=en-US&locale=es-ES&repo=central&search_type=strings&recherche=fichero&json

and I just get:

[]

and I can't even use View -> Source code to see if there's anything
besides the square brackets in the reply.

If I try the same query without the "&json" ending parameter in the
URL, the web page (correctly) returns results.

Has the parameter to ask for JSON format changed in recent Transvision
versions? The syntax I've used worked for me before.

TIA

--
Ricardo Palomares (RickieES)
http://www.mozilla-hispano.org/
http://www.proyectonave.es/
https://diasp.eu/u/rickiees

Pascal Chevrel

unread,
May 26, 2013, 2:56:55 PM5/26/13
to
Le 26/05/2013 00:48, Ricardo Palomares Martí­nez a écrit :
> Hi,
>
> I'm having problems getting Transvision 2.5 response in JSON format.
> I'm using this URL:
>
> http://transvision.mozfr.org/?sourcelocale=en-US&locale=es-ES&repo=central&search_type=strings&recherche=fichero&json
>
> and I just get:
>
> []
>
> and I can't even use View -> Source code to see if there's anything
> besides the square brackets in the reply.
>
> If I try the same query without the "&json" ending parameter in the
> URL, the web page (correctly) returns results.
>
> Has the parameter to ask for JSON format changed in recent Transvision
> versions? The syntax I've used worked for me before.
>
> TIA
>

Hi Ricardo,

The web interface gives you 2 tables (one search in the source locale,
one search in the target locale), the json source gives you results for
one locale repo only, the sourcelocale one. In, your example, you will
need to set the sourcelocale key to es-ES. [] is the valid notation for
an empty json array.

I don't remember changing the behaviour recently.

Here is the query you should use:
http://transvision.mozfr.org/?sourcelocale=es-ES&repo=central&recherche=fichero&json

Pascal

PS: contraty to appearances, I am still on holidays but will be back soon ;)

Ricardo Palomares Martí­nez

unread,
May 27, 2013, 5:44:12 PM5/27/13
to
El 26/05/13 20:56, Pascal Chevrel escribió:
> Hi Ricardo,
>
> The web interface gives you 2 tables (one search in the source locale,
> one search in the target locale), the json source gives you results
> for one locale repo only, the sourcelocale one. In, your example, you
> will need to set the sourcelocale key to es-ES. [] is the valid
> notation for an empty json array.


I understand that, it is just that I puzzled me that Firefox/SeaMonkey
couldn't show the source code for it.

I've tried your suggestion and it works, except that it still features
two languages: the source locale is now "es-ES" and the target locale
is "fr". :-) So i get things like:

"browser/chrome/browser/devtools/gclicommands.properties:cookieSetSessionDesc":{"Sólo
es válido durante la vida de la sesión del navegador":"Seulement
valide pour la durée de vie de la session du navigateur"}

Is that behaviour intended?

The reason behind this is that I'm considering adding a Transvision
query feature in MozillaTranslator. The search term could be sometimes
in en-US and sometimes in the target locale "ab-CD", but in both cases
I would need to receive back both the en-US and the ab-CD pair, so the
user can choose between the presented results. And I presume most L10n
tools that could benefit from Transvision service would ask for the same.


> PS: contraty to appearances, I am still on holidays but will be back
> soon ;)


Sorry to disturb your holidays. Just in case, I can surely wait for
you to finish enjoying a well deserved vacation. :-)

Pascal Chevrel

unread,
May 28, 2013, 4:59:08 AM5/28/13
to
Le 27/05/2013 23:44, Ricardo Palomares Martí­nez a écrit :
> El 26/05/13 20:56, Pascal Chevrel escribió:
>> Hi Ricardo,
>>
>> The web interface gives you 2 tables (one search in the source locale,
>> one search in the target locale), the json source gives you results
>> for one locale repo only, the sourcelocale one. In, your example, you
>> will need to set the sourcelocale key to es-ES. [] is the valid
>> notation for an empty json array.
>
>
> I understand that, it is just that I puzzled me that Firefox/SeaMonkey
> couldn't show the source code for it.
>
> I've tried your suggestion and it works, except that it still features
> two languages: the source locale is now "es-ES" and the target locale
> is "fr". :-) So i get things like:
>
> "browser/chrome/browser/devtools/gclicommands.properties:cookieSetSessionDesc":{"Sólo
> es válido durante la vida de la sesión del navegador":"Seulement
> valide pour la durée de vie de la session du navigateur"}
>
> Is that behaviour intended?

Fr is the fallback locale for the json feed because we don't do locale
detection there, only on the web pages.

You can specify the target locale too:
http://transvision.mozfr.org/?sourcelocale=es-ES&locale=de&repo=central&recherche=fichero&json

>
> The reason behind this is that I'm considering adding a Transvision
> query feature in MozillaTranslator. The search term could be sometimes
> in en-US and sometimes in the target locale "ab-CD", but in both cases
> I would need to receive back both the en-US and the ab-CD pair, so the
> user can choose between the presented results. And I presume most L10n
> tools that could benefit from Transvision service would ask for the same.
>

cool :)

I can extend the API to fit your needs, could you file an issue on our
github account with specific examples please?
https://github.com/mozfr/transvision/issues?state=open

Thanks

Pascal

Ricardo Palomares Martí­nez

unread,
May 28, 2013, 5:29:56 PM5/28/13
to
El 28/05/13 10:59, Pascal Chevrel escribió:
> Fr is the fallback locale for the json feed because we don't do locale
> detection there, only on the web pages.
>
> You can specify the target locale too:
> http://transvision.mozfr.org/?sourcelocale=es-ES&locale=de&repo=central&recherche=fichero&json


You were supposed to be on holidays, weren't you? :-)

I've tried using this URL:

http://transvision.mozfr.org/?sourcelocale=es-ES&locale=en-US&repo=central&search_type=strings&recherche=navegador&json

but I still get fr as the target language:

{"browser\/chrome\/browser\/devtools\/gclicommands.properties:cookieSetSessionDesc":{"S\u00f3lo
es v\u00e1lido durante la vida de la sesi\u00f3n del
navegador":"Seulement valide pour la dur\u00e9e de vie de la session
du navigateur"},...}


I've browsing Transvision source code in the Github page and I think
I've traced the cause down to central.txt not having en-US in it. The
relevant code would be around here:

https://github.com/mozfr/transvision/blob/master/web/inc/l10n-init.php#L21

IIUC, you can't set en-US as "target locale", and you can't search in
the target locale. Therefore you can't search for a term in the
localization (like es-ES or de) and get back the collection of
matching strings with the en-US corresponding strings.


> I can extend the API to fit your needs, could you file an issue on our
> github account with specific examples please?
> https://github.com/mozfr/transvision/issues?state=open


Filed #74 just about the lack of en-US in JSON replies when not
searching on en-US:

https://github.com/mozfr/transvision/issues/74

I've probably been too verbose with the description and scarce with
examples (as I haven't included anyone!) :-) but feel free to ask me
for any examples that can make clearer the request or possible solutions.

Anyway, I think I could make it work just for en-US searches at the
moment.

Thanks a lot for your help.
0 new messages