How to access i18n translation utility from hbs within a <script> tag?

Hi all, I am initializing the following with search.hbs:

<script type="text/javascript">
    /* Create a configuration object */
    var ss360Config = {
        siteId: location.hostname,
        showResultLink: true,
        showErrors: true,
        layout: {
            navigation: {
                position: "top"
            mobile: {
                showUrl: true
            desktop: {
                showUrl: true
        suggestions: {
            show: false
        style: {
            themeColor: "#00843c",
            defaultCss: true
        searchBox: {
            placeholder: "search for recipes, products, or fast food",
            selector: "#query"
        results: {
            /* Fullscreen configuration */
            fullScreenConfig: {
                trigger: "#ss360-search-trigger",
                caption: "Search this Demo Site"
            /* End of fullscreen configuration */
            caption: "Search results for your query #QUERY#",
            moreResultsPagingSize: 5

I have tried to replace the string with {{t "Search"}} but this break the javascript in it,

Is there a way I can access the i18n translation utility from within a <script> code block ?

Thanks a lot for reading/helping,


  placeholder: '{{t "Search" }}',
1 Like

Yes it works, thanks a lot for the help,

Best wishes

1 Like