Versione API Graph

/{app-id}/translations

Le stringhe di questa app che sono state tradotte usando i nostri strumenti di traduzione.

Lettura

GET /v27.0/{app-id}/translations?locale=fr_FR HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{app-id}/translations?locale=fr_FR',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
Bundle params = new Bundle();
params.putString("locale", "fr_FR");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{app-id}/translations",
    params,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
NSDictionary *params = @{
  @"locale": @"fr_FR",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{app-id}/translations"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Autorizzazioni

  • Per ottenere traduzioni dell'app, è necessario un token d'accesso dell'app stessa.

Modificatori

Nome Descrizione Tipo

locale

Specifica quale lingua richiedere. Si tratta di un parametro richiesto per la lettura di questo edge.

enum{lingua}

Campi

Nome Descrizione Tipo

id

Un ID univoco per ogni singola stringa.

string

translation

La stringa tradotta.

string

approval_status

Lo stato di approvazione della stringa.

enum{auto-approved, approved, unapproved}

native_string

La stringa originale che è stata tradotta.

string

description

La descrizione fornita per la stringa.

string

Pubblicazione

Puoi specificare le nuove stringhe da tradurre per la tua app usando questo edge:

POST /v27.0/{app-id}/translations HTTP/1.1
Host: graph.facebook.com

native_strings=%5B%7B%22text%22%3A%22Test+String%22%2C+%22description%22%3A+%22This+is+a+test+string+for+an+app.%22%7D%5D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post(
    '/{app-id}/translations',
    array (
      'native_strings' => '[{"text":"Test String", "description": "This is a test string for an app."}]',
    ),
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
Bundle params = new Bundle();
params.putString("native_strings", "[{\"text\":\"Test String\", \"description\": \"This is a test string for an app.\"}]");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{app-id}/translations",
    params,
    HttpMethod.POST,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
NSDictionary *params = @{
  @"native_strings": @"[{\"text\":\"Test String\", \"description\": \"This is a test string for an app.\"}]",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{app-id}/translations"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Autorizzazioni

  • Per aggiungere nuove stringhe di traduzione all'app, è necessario un token d'accesso dell'app stessa.

Campi

Nome Descrizione Tipo

Vettore

Vettore

Vettore

Risposta

In caso di esito positivo, riceverai una risposta semplice con il numero di stringhe aggiunte, in caso contrario riceverai un messaggio di errore.

Eliminazione

Puoi eliminare le stringhe di traduzione tramite questa operazione:

<code-tabs-path language="phpsdk,iossdk,androidsdk,http" method="DELETE" param='{"native_hashes":"['hash1', 'hash2']"}' path="/{app-id}/translations" rendering_context="1" />

Autorizzazioni

  • Per eliminare stringhe di traduzione dall'app, è necessario un token d'accesso dell'app stessa.

Campi

Nome Descrizione Tipo

native_hashes

Un array di hash per ogni stringa di traduzione. L'hash è un identificatore univoco per ogni stringa e può essere recuperato usando la translation tabella FQL.

string[]

Risposta

In caso di esito positivo, riceverai una risposta semplice con il numero di stringhe eliminate, in caso contrario riceverai un messaggio di errore.