On top in my new feed google dich năm 2024

Initially, I thought the Google Translate API v2 couldn't be used in the frontend due to CORS issues. However, when I input the code below into the browser, the API is being called normally.

I'm curious if it's okay to call the API directly from the browser from the beginning.

const url = 'https://translation.googleapis.com/language/translate/v2?key={{API_KEY}}';
const headers = {
  'Content-Type': 'application/json; charset=utf-8',
};
fetch(url, {
  method: 'POST',
  headers: headers,
  body: JSON.stringify({
    "q": ["Hello world", "My name is Jeff"],
    "target": "de"
  }),
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error(error));

Translate your product feed with the Google Translate and Google Translate (Advanced) data services in Productsup.

Introduction

To let you translate your product information, such as titles or descriptions, into any language you need, Productsup offers two (2) data services:

  1. The Google Translate data service
  2. The Google Translate (Advanced) data service

These data services are helpful if your product catalog is available only in one language, but you use it across different countries. You can also use them to quickly translate your product information for trying out a new market.

Both data services use the Google Cloud Translation API and can detect the language of the attribute you want to translate. Using the Google Cloud Translation API isn't free, the pricing depends on the chosen API option.

Here is how the data services differ:

Google Translate data service

Google Translate (Advanced) data service

Uses Translation API Basic.

See for more details on the capabilities of this option.

See Cloud Translation pricing for cost details.

Uses Translation API Advanced.

See for more details on the capabilities of this option.

See Cloud Translation pricing for cost details.

Translates your product data without using any custom glossaries.

Lets you use glossaries created in your Google Cloud service account to consistently translate the needed terms and phrases.

Lets you translate only one (1) attribute within one data service setup.

Lets you translate one or multiple attributes within one data service setup without adding the data service multiple times.

When fetching translations for your product data, the translation data services add two (2) new attributes to your site per each translated column if you have only one (1) target language. Each additional target language adds one (1) more attribute per each translated column.

The names of the added attributes vary per data service. The following examples use the default prefix ___service_google_translate. If you change your prefix in the data service setup, the names of the added attributes are going to look different, but the endings of the attribute names will still be as shown below.

The Google Translate data service adds:

The Google Translate (Advanced) data service adds:

  • ___service_google_translate_md5, an attribute that contains the hash value created for the already translated values, which means that the site caches those values and keeps them unchanged if the data service runs again.
  • ___service_google_translate_xx_yy, where xx is the source language and yy is the target language. These attributes contain the desired translations.
  • ___service_google_translate_column_md5, where column is the name of the column the data service translated. This attribute contains the hash value created for the already translated values, which means that the site caches those values and keeps them unchanged if the data service runs again.
  • ___service_google_translate_column_xx_yy, where column is the name of the column the data service translated, xx is the source language, and yy is the target language. These attributes contain the desired translations.

Prerequisites

Each translation data service has its own set of prerequisites:

  1. Google Translate data service:
    1. A product identifier. See Set a product identifier.
    2. An API key to authenticate in Google Cloud. You need to enable and purchase it. See Cloud Translation API Key.
  2. Google Translate (Advanced) data service:
    1. A product identifier. See Set a product identifier.
    2. A Google Cloud service account with at least one project created in it. See Setup for more information.
    3. The region of your Google Cloud project. See Regions and zones.
    4. The configuration of your Google Cloud service account in the JSON format. It should feature the needed project ID, private key, client ID, etc. See .
    5. The ID of a glossary associated with a relevant Google Cloud project. The platform only supports glossaries in the CSV format. See .

      See Creating and using glossaries (Advanced) for more information.

      Note

      This prerequisite is optional. You need a glossary ID only if you want to use a glossary for your translations.

Add the Google Translate data service

  • Go to Data Services from your site's main menu and select ADD SERVICE.
  • Search for Google Translate and select Add.
  • Give it a desired name and column prefix. By default, ___service_google_translate is the column prefix.
  • Choose the stage containing the columns you want to translate in Service Data Level and select Add.
  • Select the column you want to translate from the Column drop-down list.

    Note

    If you choose Import in Service Data Level, the drop-down list Column displays the columns of your import stage. If you choose Intermediate, the drop-down list contains your intermediate-stage columns.
  • Select a source language from the Source language drop-down menu.
  • Select one or several target languages in the Target languages field. Hold the CTRL or Cmd key to select more than one language.
  • In API key, enter your Google Cloud Translation API key.
  • If you want the platform to run the data service every time there is a refresh in Data View, check the box Trigger during a refresh in Data View.
  • Select Save.

For the platform to process a new data service, select Run in the top-right corner of your site's view.

Note

If you can't see the columns that the Google Translate data service added to your feed in Data View, ensure the platform hasn't hidden them:

  • Go to Data View from your site's main menu and choose the relevant stage or export in the drop-down list on your left.
  • Select the menu icon on the right and then select the eye icon.

Find the attributes in the list that use the default prefix ___service_google_translate or a prefix that you set up in and select the eye icon next to each attribute you want Data View to display. The attribute names that the data service generates always start with three underscores (`___service_google_translate_md5`3), which means the platform doesn't send those attributes to your export channels.

How do I translate Google lens on screen?

To translate text you find on things like menus and signs, open your Camera app . Tap Lens in your homescreen's search bar and then tap Translate. You can also go to the Camera app and tap Modes > Lens > Translate. Then tap and hold the text you'd like to translate and tap Translate.

Is Google Translate always correct?

A 2021 study conducted by the UCLA Medical Center found that Google Translate preserved the overall meaning for 82.5% of the translations. But the accuracy between languages spanned 55% to 94%. Sometimes, Google Translate's precision is shockingly good.

How do I use Google Translate on my Android phone?

Use Tap to Translate.

Open an app with text you can copy..

Highlight the text you want to translate. Copy..

On your current screen, tap Google Translate ..

Choose the language you want..

How can Google Translate a Web page?

When you come across a page written in a language you don't understand, you can use Chrome to translate the page..

On your computer, open Chrome..

Go to a webpage written in another language..

On the right of the address bar, click Translate ..

Click on your preferred language..

Chrome will translate your current webpage..