Support » Plugin: TranslatePress - Translate Multilingual sites » Problem with auto google translate

  • Resolved Alaa Rihan

    (@alaa-rihan)


    Hello,

    I have a wp network installation I enabled this plugin in two sites one of them auto translate work with no problem but the other one isn’t, I have google translate api key and I did the test from settings of the plugin, I get this result:

    Google API Key from settings page: 
    Response:
                    Array
    (
        [code] => 200
        [message] => OK
    )
                
    Response Body:
                    {
      "data": {
        "translations": [
          {
            "translatedText": "acerca de"
          }
        ]
      }
    }
                
    Entire Response From wp_remote_get():
                    Array
    (
        [headers] => Requests_Utility_CaseInsensitiveDictionary Object
            (
                [data:protected] => Array
                    (
                        [content-type] => application/json; charset=UTF-8
                        [vary] => Array
                            (
                                [0] => Origin
                                [1] => X-Origin
                                [2] => Referer
                            )
    
                        [content-encoding] => gzip
                        [date] => Wed, 24 Jan 2018 13:57:25 GMT
                        [server] => ESF
                        [cache-control] => private
                        [x-xss-protection] => 1; mode=block
                        [x-frame-options] => SAMEORIGIN
                        [x-content-type-options] => nosniff
                        [alt-svc] => hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
                    )
    
            )
    
        [body] => {
      "data": {
        "translations": [
          {
            "translatedText": "acerca de"
          }
        ]
      }
    }
    
        [response] => Array
            (
                [code] => 200
                [message] => OK
            )
    
        [cookies] => Array
            (
            )
    
        [filename] => 
        [http_response] => WP_HTTP_Requests_Response Object
            (
                [response:protected] => Requests_Response Object
                    (
                        [body] => {
      "data": {
        "translations": [
          {
            "translatedText": "acerca de"
          }
        ]
      }
    }
    
                        [raw] => HTTP/1.1 200 OK
    Content-Type: application/json; charset=UTF-8
    Vary: Origin
    Vary: X-Origin
    Vary: Referer
    Content-Encoding: gzip
    Date: Wed, 24 Jan 2018 13:57:25 GMT
    Server: ESF
    Cache-Control: private
    X-XSS-Protection: 1; mode=block
    X-Frame-Options: SAMEORIGIN
    X-Content-Type-Options: nosniff
    Alt-Svc: hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
    Connection: close
    Transfer-Encoding: chunked
    
    {
      "data": {
        "translations": [
          {
            "translatedText": "acerca de"
          }
        ]
      }
    }
    
                        [headers] => Requests_Response_Headers Object
                            (
                                [data:protected] => Array
                                    (
                                        [content-type] => Array
                                            (
                                                [0] => application/json; charset=UTF-8
                                            )
    
                                        [vary] => Array
                                            (
                                                [0] => Origin
                                                [1] => X-Origin
                                                [2] => Referer
                                            )
    
                                        [content-encoding] => Array
                                            (
                                                [0] => gzip
                                            )
    
                                        [date] => Array
                                            (
                                                [0] => Wed, 24 Jan 2018 13:57:25 GMT
                                            )
    
                                        [server] => Array
                                            (
                                                [0] => ESF
                                            )
    
                                        [cache-control] => Array
                                            (
                                                [0] => private
                                            )
    
                                        [x-xss-protection] => Array
                                            (
                                                [0] => 1; mode=block
                                            )
    
                                        [x-frame-options] => Array
                                            (
                                                [0] => SAMEORIGIN
                                            )
    
                                        [x-content-type-options] => Array
                                            (
                                                [0] => nosniff
                                            )
    
                                        [alt-svc] => Array
                                            (
                                                [0] => hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
                                            )
    
                                    )
    
                            )
    
                        [status_code] => 200
                        [protocol_version] => 1.1
                        [success] => 1
                        [redirects] => 0
                        [url] => https://www.googleapis.com/language/translate/v2
                        [history] => Array
                            (
                            )
    
                        [cookies] => Requests_Cookie_Jar Object
                            (
                                [cookies:protected] => Array
                                    (
                                    )
    
                            )
    
                    )
    
                [filename:protected] => 
                [data] => 
                [headers] => 
                [status] => 
            )
    
    )

    so I don't know what's going on.

    The other site auto translate works when I click "Translate page" but I have to do this for each page and wait to have it auto translated, I have about 500 pages in the site so what should I do to auto translate them?

    And what is the problem in the first site? (auto translate isn't working at all).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Cristian Antohe

    (@sareiodata)

    Hi,

    It looks like the API key works as expected.

    However, the page gets translated on the first visit to it in another language or when you navigate via the translation editor.

    That’s how it’s designed. Otherwise, translating everything at once could potentially bring down the site.

    If you visit a translated page like http://www.example.com/fr/about , does it generate the translation for it on the first time or the second time you load it? Or it just doesn’t translate it at all.

    If it’s the later, try and clear your caching (if you have any and try again)

    camilonieto

    (@camilonieto)

    Hello,

    I have a similar problem, in the translator’s manager I write the automatic translation of Google Translate; but on the website it does not appear translated.

    I deleted the cache, but it still does not work.

    I would like to send you screen impressions, but there is no option.

    Can you help me please.

                  Array
    (
        [code] => 200
        [message] => OK
    )
                
    Response Body:
                    {
      "data": {
        "translations": [
          {
            "translatedText": "acerca de"
          }
        ]
      }
    }
                
    Entire Response From wp_remote_get():
                    Array
    (
        [headers] => Requests_Utility_CaseInsensitiveDictionary Object
            (
                [data:protected] => Array
                    (
                        [content-type] => application/json; charset=UTF-8
                        [vary] => Array
                            (
                                [0] => Origin
                                [1] => X-Origin
                                [2] => Referer
                            )
    
                        [content-encoding] => gzip
                        [date] => Tue, 20 Feb 2018 01:30:00 GMT
                        [server] => ESF
                        [cache-control] => private
                        [x-xss-protection] => 1; mode=block
                        [x-frame-options] => SAMEORIGIN
                        [x-content-type-options] => nosniff
                        [alt-svc] => hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
                    )
    
            )
    
        [body] => {
      "data": {
        "translations": [
          {
            "translatedText": "acerca de"
          }
        ]
      }
    }
    
        [response] => Array
            (
                [code] => 200
                [message] => OK
            )
    
        [cookies] => Array
            (
            )
    
        [filename] => 
        [http_response] => WP_HTTP_Requests_Response Object
            (
                [response:protected] => Requests_Response Object
                    (
                        [body] => {
      "data": {
        "translations": [
          {
            "translatedText": "acerca de"
          }
        ]
      }
    }
    
                        [raw] => HTTP/1.1 200 OK
    Content-Type: application/json; charset=UTF-8
    Vary: Origin
    Vary: X-Origin
    Vary: Referer
    Content-Encoding: gzip
    Date: Tue, 20 Feb 2018 01:30:00 GMT
    Server: ESF
    Cache-Control: private
    X-XSS-Protection: 1; mode=block
    X-Frame-Options: SAMEORIGIN
    X-Content-Type-Options: nosniff
    Alt-Svc: hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
    Connection: close
    Transfer-Encoding: chunked
    
    {
      "data": {
        "translations": [
          {
            "translatedText": "acerca de"
          }
        ]
      }
    }
    
                        [headers] => Requests_Response_Headers Object
                            (
                                [data:protected] => Array
                                    (
                                        [content-type] => Array
                                            (
                                                [0] => application/json; charset=UTF-8
                                            )
    
                                        [vary] => Array
                                            (
                                                [0] => Origin
                                                [1] => X-Origin
                                                [2] => Referer
                                            )
    
                                        [content-encoding] => Array
                                            (
                                                [0] => gzip
                                            )
    
                                        [date] => Array
                                            (
                                                [0] => Tue, 20 Feb 2018 01:30:00 GMT
                                            )
    
                                        [server] => Array
                                            (
                                                [0] => ESF
                                            )
    
                                        [cache-control] => Array
                                            (
                                                [0] => private
                                            )
    
                                        [x-xss-protection] => Array
                                            (
                                                [0] => 1; mode=block
                                            )
    
                                        [x-frame-options] => Array
                                            (
                                                [0] => SAMEORIGIN
                                            )
    
                                        [x-content-type-options] => Array
                                            (
                                                [0] => nosniff
                                            )
    
                                        [alt-svc] => Array
                                            (
                                                [0] => hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
                                            )
    
                                    )
    
                            )
    
                        [status_code] => 200
                        [protocol_version] => 1.1
                        [success] => 1
                        [redirects] => 0
                        [url] => https://www.googleapis.com/language/translate/v2
                        [history] => Array
                            (
                            )
    
                        [cookies] => Requests_Cookie_Jar Object
                            (
                                [cookies:protected] => Array
                                    (
                                    )
    
                            )
    
                    )
    
                [filename:protected] => 
                [data] => 
                [headers] => 
                [status] => 
            )
    
    )
    Plugin Author Cristian Antohe

    (@sareiodata)

    Hi @camilonieto

    The response from Google looks ok. It should translate the detected strings.

    After entering the API key, have you also ENABLED Google Translate? There is a setting above where you enter the API key.

    If you visit the translated page and reload a few times, does it work?

    Also, it’s possible the language you’re trying to translate in is not supported by Google Translate: https://cloud.google.com/translate/docs/languages

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problem with auto google translate’ is closed to new replies.