Version API du graphe

/{app-id}/translations

Les chaînes de cette application qui ont été traduites à l'aide de nos outils de traduction.

Lecture

GET /v25.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
}];

Autorisations

  • Un token d'accès d'application est requis pour renvoyer des traductions pour cette application.

Modificateurs

Nom Description Type

locale

Indique le paramètre linguistique de la langue à demander. Il s’agit d’un paramètre obligatoire lors de la lecture de cette arête.

enum{locale}

Champs

Nom Description Type

id

Un ID unique correspondant à chaque chaîne.

string

translation

La chaîne de caractères traduite.

string

approval_status

L’état d'approbation de la chaîne.

enum{auto-approved, approved, unapproved}

native_string

La chaîne originale qui a été traduite.

string

description

La description fournie de la chaîne.

string

Publication

Vous pouvez spécifier les nouvelles chaînes à traduire pour votre application avec cette arête :

POST /v25.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
}];

Autorisations

  • Un token d'accès d'application est requis pour ajouter de nouvelles chaînes à traduire pour cette application.

Champs

Nom Description Type

Vecteur

Vecteur

Vecteur

Réponse

En cas de réussite, vous recevrez une réponse brute indiquant le nombre de chaînes qui ont été ajoutées, sinon vous recevrez un message d'erreur.

Suppression

Vous pouvez supprimer des chaînes traduites en utilisant cette opération :

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

Autorisations

  • Un token d'accès d'application est requis pour supprimer des chaînes à traduire de cette application.

Champs

Nom Description Type

native_hashes

Un tableau répertoriant les hashs des différentes chaînes à traduire. Le hash est un identifiant unique pour chaque chaîne, et peut être récupéré à l'aide de la translationtable FQL.

string[]

Réponse

En cas de réussite, vous recevrez une réponse brute indiquant le nombre de chaînes supprimées, sinon vous recevrez un message d'erreur.