Recent

Author Topic: extract data from json ? pls help  (Read 23933 times)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1194
  • Professional amateur ;-P
Re: extract data from json ? pls help
« Reply #30 on: December 16, 2021, 09:13:31 am »
Hey J.P.,

Thanks for this. I am a french guy and i will have a look on you wiki french page.

You're more than welcome.
Thanks for that :)
I wouldn't feel good leaving the French page out of synch due to the fact that French is one of my 3 mother languages :)

Don't forget one thing :
Quote
translate.googleapis.com site use is very limited. It only allows about 100 requests per one hour period and there after returns a 429 error (Too many requests)

That's actually a good piece of info to leave on the page.
I'll add that some time later. Many thanks for the tip!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
Re: extract data from json ? pls help
« Reply #31 on: December 16, 2021, 10:50:44 am »
Funny enough, the template it self has the link to the Portuguese language, but none of the translations will show it.
Bummer...

The page templates are cached, so you have to purge the cache by adding ?action=purge to the URL. Worry not, I've purged them for you and all are now as they should be :)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1194
  • Professional amateur ;-P
Re: extract data from json ? pls help
« Reply #32 on: December 16, 2021, 11:54:17 am »
Hey Trev,

The page templates are cached, so you have to purge the cache by adding ?action=purge to the URL. Worry not, I've purged them for you and all are now as they should be :)

Thanks mate, you're a life saver :)

And thank you, also, for the tid bit about the cache purging, that's rather useful too!!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1272
Re: extract data from json ? pls help
« Reply #33 on: December 16, 2021, 12:49:06 pm »
Hey Gus,
I've updated the French version of the page: https://wiki.lazarus.freepascal.org/Using_Google_Translate/fr
Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1194
  • Professional amateur ;-P
Re: extract data from json ? pls help
« Reply #34 on: December 17, 2021, 12:17:35 am »
Hey J.P.,

I've updated the French version of the page: https://wiki.lazarus.freepascal.org/Using_Google_Translate/fr

Merci biens mon cher!!

Only one thing of notice: You list the wrong URL for the Paid API.
The paid API is located here: https://translation.googleapis.com/language/translate/v2

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1272
Re: extract data from json ? pls help
« Reply #35 on: December 17, 2021, 07:38:29 am »
Hey Gus,
Only one thing of notice: You list the wrong URL for the Paid API.
The paid API is located here: https://translation.googleapis.com/language/translate/v2

OK ! it's corrected

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1194
  • Professional amateur ;-P
Re: extract data from json ? pls help
« Reply #36 on: December 17, 2021, 07:43:31 am »
Hey J.P.,

OK ! it's corrected


AWESOME!! Thanks J.P.!!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
Re: extract data from json ? pls help
« Reply #37 on: December 19, 2021, 06:19:16 am »
I had a look at the Google Translate product and could not find the "free, metered way" described on the Wiki page. The Translate BASIC and Translate ADVANCED REST methods both required an API key and a Google Account, Google Project id and Google credit. The closest "free" way I could find was the first 500,000 characters per month were free, after which it cost $US 20/million characters, for Translate BASIC (the first 500,000 characters being provided by way of an ongoing Google credit of $US 10/month). See https://cloud.google.com/translate/pricing.

Perhaps the Wiki page could do with an update unless I'm missing something?

The French page URL for the "free metered API" service is also a 404 and the Wiki claims 100 requests an hour are free (with a to be confirmed annotation).
« Last Edit: December 19, 2021, 06:21:38 am by trev »

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1272
Re: extract data from json ? pls help
« Reply #38 on: December 19, 2021, 06:54:02 am »
hello trev,
if you only try the free url api shown in the wiki page, you have a 404 response, but if you try the url with all the parameters like this :
Quote
https://translate.googleapis.com/translate_a/single?client=gtx&q=bonjour&sl=fr&tl=en&dt=t&ie=UTF-8&oe=UTF-8
it's OK you have a json response.
The urls shown must not be used without parameters.
Friendly, J.P
« Last Edit: December 19, 2021, 12:41:53 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
Re: extract data from json ? pls help
« Reply #39 on: December 19, 2021, 01:47:10 pm »
Thanks JP, that solves that mystery :)

 

TinyPortal © 2005-2018