JavaScript
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
await client.translations.update('locale', { domain: 'domain', body: 'body' });import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
client.translations.update(
locale="locale",
domain="domain",
body="body",
)package main
import (
"context"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Translations.Update(
context.TODO(),
"locale",
courier.TranslationUpdateParams{
Domain: "domain",
Body: "body",
},
)
if err != nil {
panic(err.Error())
}
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.translations.TranslationUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TranslationUpdateParams params = TranslationUpdateParams.builder()
.domain("domain")
.locale("locale")
.body("body")
.build();
client.translations().update(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
result = courier.translations.update("locale", domain: "domain", body: "body")
puts(result)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$result = $client->translations->update(
'locale', domain: 'domain', body: 'body'
);
var_dump($result);
} catch (APIException $e) {
echo $e->getMessage();
}using TryCourier;
using TryCourier.Models.Translations;
CourierClient client = new();
TranslationUpdateParams parameters = new()
{
Domain = "domain",
Locale = "locale",
Body = "body",
};
await client.Translations.Update(parameters);courier translations update \
--api-key 'My API Key' \
--domain domain \
--locale locale \
--body bodycurl --request PUT \
--url https://api.courier.com/translations/{domain}/{locale} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '"<string>"'{
"message": "Example message text",
"type": "invalid_request_error"
}Translations
Update translations by locale
Update a translation
PUT
/
translations
/
{domain}
/
{locale}
JavaScript
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
await client.translations.update('locale', { domain: 'domain', body: 'body' });import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
client.translations.update(
locale="locale",
domain="domain",
body="body",
)package main
import (
"context"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Translations.Update(
context.TODO(),
"locale",
courier.TranslationUpdateParams{
Domain: "domain",
Body: "body",
},
)
if err != nil {
panic(err.Error())
}
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.translations.TranslationUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TranslationUpdateParams params = TranslationUpdateParams.builder()
.domain("domain")
.locale("locale")
.body("body")
.build();
client.translations().update(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
result = courier.translations.update("locale", domain: "domain", body: "body")
puts(result)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$result = $client->translations->update(
'locale', domain: 'domain', body: 'body'
);
var_dump($result);
} catch (APIException $e) {
echo $e->getMessage();
}using TryCourier;
using TryCourier.Models.Translations;
CourierClient client = new();
TranslationUpdateParams parameters = new()
{
Domain = "domain",
Locale = "locale",
Body = "body",
};
await client.Translations.Update(parameters);courier translations update \
--api-key 'My API Key' \
--domain domain \
--locale locale \
--body bodycurl --request PUT \
--url https://api.courier.com/translations/{domain}/{locale} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '"<string>"'{
"message": "Example message text",
"type": "invalid_request_error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The domain you want to retrieve translations for. Only default is supported at the moment
The locale you want to retrieve the translations for
Body
application/json
.po file translation content
The body is of type string.
Response
⌘I