We just launched our new Hygraph Studio in beta. Learn more

Hygraph
Docs

Localized assets

#Hygraph Asset Management

Our asset system lets you create a localizations by providing as fileName (optional) and uploadUrl. You can use the createAsset mutation and create the localization simultaneously, or use updateAsset and add a localization to an existing asset.

The following example shows the URL upload of an asset along with its localized content:

mutation test {
createAsset(
data: {
uploadUrl: "<UPLOAD_URL>"
localizations:{
create: {
locale: de
data:{
uploadUrl: "<LOCALE_UPLOAD_URL>"
}
}
}
}
) {
id
url
localizations {
id
url
}
}
}

This other example updates an existing asset entry, adding the de localization:

mutation test {
updateAsset(
where: {id: "<ASSET_ID>"}
data: {
localizations: {
create: {
locale: de,
data: {
uploadUrl: "<LOCALE_UPLOAD_URL>"
}
}
}
}
) {
id
locale
url
localizations {
url
locale
}
}
}

Learn more about mutating localized content.

#Legacy asset system

Since assets are localized by default, you can upload a file for your project locales.

You can do this from the UI: Simply navigate to Assets and access the edit view of your asset entry.

Click the eye icon next to your localization to ensure the Upload button is visible.

Asset localization - Legacy asset systemAsset localization - Legacy asset system

#Localize assets in the UI

You can also localize assets using the UI. Check out this document to learn more.