Search Storyblok's Documentation
  1. Internationalization for Stories

Internationalization for Stories

If you use our field-level translation functionality, you will also receive the translated content while fetching the story. Translated content can be viewed just next to the default content. Translated fields will have appended __i18n__ to the field name followed by the language code.

Similarly, for creating or updating content, you can provide the values for the translations/languages within the same content object by appending __i18n__ followed by the language code. Make sure to have the component field option translatable to true.

Get a full list of our languages codes on Github.

Story Response
story: {
    // ...
    "content": {
      "_uid": "61a81f04-fb28-41f1-897a-8614df7f4143",
      "body": [
         {
            "_uid": "9d3ade8f-5a40-43df-8ab0-7b148f036567",
            "headline": "This is awesome!",
            "headline__i18n__de": "Das ist toll!",
            "component": "teaser", 
          },
      }
    // ...
}
Request
curl "https://mapi.storyblok.com/v1/spaces/606/stories" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: YOUR_OAUTH_TOKEN" \
  -d "{\"story\": {\"name\": \"My First Article\",\"slug\": \"first-post\",\"content\": {\"component\": \"post\",\"headline\": \"This is awesome!\",\"headline__i18n__de\": \"Das ist toll!\"}},\"publish\": 1}"
Request
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.post('/spaces/606/stories', {
  "story": {
    "name": "My First Article",
    "slug": "first-post",
    "content": {
      "component": "post",
      "headline": "This is awesome!",
      "headline__i18n__de": "Das ist toll!"
    }
  },
  "publish": 1
})
  .then(response => {
    console.log(response)
  }).catch(error => { 
    console.log(error)
  })
Request
$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');

$payload = [
  "story" =>  [
    "name" =>  "My First Article",
    "slug" =>  "first-post",
    "content" =>  [
      "component" =>  "post",
      "headline" =>  "This is awesome!",
      "headline__i18n__de" =>  "Das ist toll!"
    ]
  ],
  "publish" =>  1
];

$client->post('/spaces/606/stories', $payload)->getBody();
Request
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')

payload = {
  "story" =>  {
    "name" =>  "My First Article",
    "slug" =>  "first-post",
    "content" =>  {
      "component" =>  "post",
      "headline" =>  "This is awesome!",
      "headline__i18n__de" =>  "Das ist toll!"
    }
  },
  "publish" =>  1
}

client.post('/spaces/606/stories', payload)
Request
HttpResponse<String> response = Unirest.post("https://mapi.storyblok.com/v1/spaces/606/stories")
  .header("Content-Type", "application/json")
  .header("Authorization", "YOUR_OAUTH_TOKEN")
  .body("{\"story\": {\"name\": \"My First Article\",\"slug\": \"first-post\",\"content\": {\"component\": \"post\",\"headline\": \"This is awesome!\",\"headline__i18n__de\": \"Das ist toll!\"}},\"publish\": 1}")
  .asString();
Request
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/606/stories");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"story\": {\"name\": \"My First Article\",\"slug\": \"first-post\",\"content\": {\"component\": \"post\",\"headline\": \"This is awesome!\",\"headline__i18n__de\": \"Das ist toll!\"}},\"publish\": 1}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Request
import Foundation

let headers = [
  "Content-Type": "application/json",
  "Authorization": "YOUR_OAUTH_TOKEN"
]

let postData = NSData(data: "{\"story\": {\"name\": \"My First Article\",\"slug\": \"first-post\",\"content\": {\"component\": \"post\",\"headline\": \"This is awesome!\",\"headline__i18n__de\": \"Das ist toll!\"}},\"publish\": 1}".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/606/stories")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)

request.method = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
Request
import requests

url = "https://mapi.storyblok.com/v1/spaces/606/stories"

querystring = {}

payload = "{\"story\": {\"name\": \"My First Article\",\"slug\": \"first-post\",\"content\": {\"component\": \"post\",\"headline\": \"This is awesome!\",\"headline__i18n__de\": \"Das ist toll!\"}},\"publish\": 1}"
headers = {
  'Content-Type': "application/json",
  'Authorization': "YOUR_OAUTH_TOKEN"
}

response = requests.request("POST", url, data=payload, headers=headers, params=querystring)

print(response.text)