LogoLogo
Home
  • Documentation
  • Developers
  • The Venue Developer Documentation
  • Next.js SDK
    • React Components
      • VenueContent
      • VenueImage
    • reference
      • Index
      • functions
        • VenueContent
        • VenueImage
        • getEvent
        • getEvents
        • getLocalizedContent
        • getPage
        • getPages
        • getProduct
        • getProducts
        • getProfile
        • getProfileEvents
        • getProfiles
        • getSite
        • setConfig
      • interfaces
        • NodeHandlers
        • NodeProps
        • RenderNode
      • type-aliases
        • ContentStyles
        • Event
        • GetEventData
        • GetEventError
        • GetEventResponse
        • GetEventsData
        • GetEventsError
        • GetEventsResponse
        • GetPageData
        • GetPageError
        • GetPageResponse
        • GetPagesData
        • GetPagesError
        • GetPagesResponse
        • GetProductData
        • GetProductError
        • GetProductResponse
        • GetProductsData
        • GetProductsError
        • GetProductsResponse
        • GetProfileData
        • GetProfileError
        • GetProfileEventsData
        • GetProfileEventsError
        • GetProfileEventsResponse
        • GetProfileResponse
        • GetProfilesData
        • GetProfilesError
        • GetProfilesResponse
        • GetSiteData
        • GetSiteError
        • GetSiteResponse
        • LocalizedContent
        • Location
        • MediaItem
        • NodeHandler
        • Page
        • Product
        • ProductVariant
        • Profile
        • Site
        • SiteSettings
        • TicketOnEvent
        • publishState
        • recordType
  • TypeScript SDK
    • reference
      • Index
      • functions
        • getEvent
        • getEvents
        • getLocalizedContent
        • getPage
        • getPages
        • getProduct
        • getProducts
        • getProfile
        • getProfileEvents
        • getProfiles
        • getSite
        • setConfig
      • type-aliases
        • Event
        • GetEventData
        • GetEventError
        • GetEventResponse
        • GetEventsData
        • GetEventsError
        • GetEventsResponse
        • GetPageData
        • GetPageError
        • GetPageResponse
        • GetPagesData
        • GetPagesError
        • GetPagesResponse
        • GetProductData
        • GetProductError
        • GetProductResponse
        • GetProductsData
        • GetProductsError
        • GetProductsResponse
        • GetProfileData
        • GetProfileError
        • GetProfileEventsData
        • GetProfileEventsError
        • GetProfileEventsResponse
        • GetProfileResponse
        • GetProfilesData
        • GetProfilesError
        • GetProfilesResponse
        • GetSiteData
        • GetSiteError
        • GetSiteResponse
        • LocalizedContent
        • Location
        • MediaItem
        • Page
        • Product
        • ProductVariant
        • Profile
        • Site
        • SiteSettings
        • TicketOnEvent
        • publishState
        • recordType
  • REST API
    • Api
      • V2
        • Public
          • Events
          • Pages
          • Products
          • Site
          • Profiles
            • Events
Powered by GitBook
On this page
  • Function: getLocalizedContent()
  • Parameters
  • Returns
  • Example
Export as PDF
  1. TypeScript SDK
  2. reference
  3. functions

getLocalizedContent

Last updated 1 day ago


Function: getLocalizedContent()

function getLocalizedContent(localizedContent, locale): object

Defined in:

This function will properly resolve content blocks that are localized. It takes in the array of localized content and returns the proper content to be used in your page.

Parameters

Parameter
Type

localizedContent

locale

string

Returns

object

Name
Type
Defined in

content

currentLocale

string

Example

import { getEvent, getLocalizedContent } from "@venuecms/sdk";
import { ContentRender, type RenderNode } from "@/lib/utils/renderer";

// let's assume we are looking at an event and want to show the locale-specific title of that event in english
const { data: event } = await getEvent({ slug });

// Use getLocalizedContent to retrieve all localized content in the correct locale
// typically you will pass a locale from your app (such as from a i18n library) but
// for clarity I am passing "en" explicitly to retrieve the english version
const { content } = getLocalizedContent(event.localizedContent, "en");

// Render the content in english using the renderer
return (
  <div>
    <VenueContent classes={renderedStyles} content={content} />
  </div>
);

[]

@venuecms/sdk
packages/sdk/src/utils/content.ts:31
LocalizedContent
LocalizedContent
packages/sdk/src/utils/content.ts:34
packages/sdk/src/utils/content.ts:34