import { getCulture , IHubRequestOptions , convertToWellKnownLocale , fetchHubTranslation , cloneObject , getProp } from "@esri/hub-common" ; import { DEFAULT_INITIATIVE_TEMPLATE } from "./default-initiative-template" ; param { IHubRequestOptions } hubRequestOptions export function getDefaultInitiativeTemplate ( hubRequestOptions ) { const culture = getCulture ( hubRequestOptions ) ; const locale = convertToWellKnownLocale ( culture ) ; return fetchHubTranslation ( locale , hubRequestOptions . portalSelf ) . then ( translation => { const tmpl = cloneObject ( DEFAULT_INITIATIVE_TEMPLATE ) ; tmpl . item . description = getProp ( translation , "addons.services.templates.customInitiative.item.description" ) ; tmpl . item . snippet = getProp ( translation , "addons.services.templates.customInitiative.item.snippet" ) ; tmpl . item . culture = locale ; return tmpl ; } ) ; }