Graph API-Version

/{app-id}/translations

Die Strings dieser App, die mit Hilfe unserer Übersetzungs-Tools übersetzt wurden.

Lesen

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
}];

Berechtigungen

  • Zur Rückgabe von Übersetzungen für diese App ist ein App-Zugriffsschlüssel erforderlich.

Modifikatoren

Name Beschreibung Typ

locale

Gibt an, welches Gebietsschema für die Sprache angefordert werden soll. Dies ist für das Lesen dieser Edge ein erforderlicher Parameter.

enum{Gebietsschema}

Felder

Name Beschreibung Typ

id

Eine eindeutige ID für jeden einzelnen String.

string

translation

Der übersetzte String.

string

approval_status

Der Genehmigungsstatus des Strings.

enum{auto-approved, approved, unapproved}

native_string

Der ursprüngliche String, der übersetzt wurde.

string

description

Die bereitgestellte Beschreibung des Strings.

string

Veröffentlichen

Du kannst neue Strings deiner App festlegen, die übersetzt werden sollen, indem du diese Edge verwendest:

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
}];

Berechtigungen

  • Zum Hinzufügen neuer Übersetzungs-Strings für diese App ist ein App-Zugriffsschlüssel erforderlich.

Felder

Name Beschreibung Typ

Vektor

Vektor

Vektor

Antwort

Bei Erfolg erhältst du eine einfache Antwort mit der Anzahl der Strings, die hinzugefügt wurden. Andernfalls erhältst du eine Fehlermeldung.

Löschen

Verwende den folgenden Vorgang, um Übersetzungsstrings zu löschen:

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

Berechtigungen

  • Zum Löschen von Übersetzungs-Strings für diese App ist ein App-Zugriffsschlüssel erforderlich.

Felder

Name Beschreibung Typ

native_hashes

Ein Array von Hashes für jeden Übersetzungs-String. Der Hash ist ein eindeutiger Identifikator für jeden String und kann mit Hilfe der translation FQL-Tabelle abgerufen werden.

string[]

Antwort

Bei Erfolg erhältst du eine einfache Antwort mit der Anzahl der Strings, die gelöscht wurden. Andernfalls erhältst du eine Fehlermeldung.