Usig goole-translate-api (Cloud Translation) requested array object value change after translation with add space and quote in response automatically

44 views
Skip to first unread message

Patel Hiren

unread,
Feb 2, 2023, 12:52:26 PM2/2/23
to Angular and AngularJS discussion
Usig goole-translate-api (Cloud Translation) requested array object value change after translation with add space and quote in response automatically

Precondition: all the required setup is done for google-translate-API.

Example Request 1:

Below data will be passed in request for translation on google-translate-API  -

Request1: { q: '[["63c69e757a0d0905c0788ec7","darshan","hello","darshan",18,"5c2cc535c1810b3bc193d267",14,0]]',target: 'es'}

This is the response we got from google-translation-api -

Response1 : [["63c69e757a0d0905c0788ec7","darshan","hola","darshan","18,"5c2cc535c1810b3bc193d267",14,0]]

The problem in response1:getting " (quote) before 18 value in response. you can see in request param not available while requesting.


Example Request 2:

Below data will be passed in request for translation on google-translate-API  -

Request2: {q: '[["61b1a627f6ec52566b8da04c","All Group","Testing","vikash",false,"0","12345678","Asia/Kolkata","1","5c2cc535c1810b3bc193d267",14,0]]',target: 'es'}

This is the response we got from google-translation-api -

Response2 :  [ ["61b1a627f6ec52566b8da04c","Todos los grupos","Pruebas","vikash",falso,"0","12345678"," Asia/Calcuta","1","5c2cc535c1810b3bc193d267",14,0]]

The problem in response2: Getting space before Asia/Calcuta - string and after " (quote).  you can see in the request param not available while requesting.

Attached file for better understanding.

Can you please help me in this?


Thanks & Regards,
Hiren Patel 
wrongResponse get from google translate api.txt
Reply all
Reply to author
Forward
0 new messages