How to translate in .js (not in .hbs)

I have forked the Casper js theme and I added a .js file for site search 360, it looks like this:

(function (window, document) {
    window.ss360Config = {
        siteId: location.hostname,
        style: {
            suggestions: {
                text: {
                    color: '#333333',
                },
                background: {
                    color: '#ffffff',
                },
                padding: '5px',
                distanceFromTop: '0px',
                border: {
                    color: '#dddddd',
                    radius: '0px',
                },
            },
            searchBox: {
                text: {
                    color: '#333333',
                    size: '14px',
                },
                background: {
                    color: '#ffffff',
                },
                border: {
                    color: '#dddddd',
                    radius: '0px',
                },
                padding: '10px',
                icon: {
                    image: 'magnifier',
                    color: '#666666',
                },
            },
        },
        results: {
            group: false,
            moreResultsButton: 'Show more results',
            infiniteScroll: true,
            fullScreenConfig: {
                trigger: '.ss360-trigger',
                caption: '',
                transition: 'fade',
            },
        },
        tracking: {
            providers: [],
        },
        layout: {
            mobile: {
                showUrl: true,
            },
            desktop: {
                showUrl: true,
            },
        },
        showErrors: false,
    };

    var e = document.createElement('script');
    e.async = !0;
    e.src = 'https://cdn.sitesearch360.com/v13/sitesearch360-v13.min.js';
    document.getElementsByTagName('body')[0].appendChild(e);
})(window, document);

This snippet was taken from the site search 360 designer tool here.

I want to translate the text from the configuration, how is it possible ?

Add the translation as a JS variable in your hbs file, somewhere to be globally accessible, the header for example. Then, access it from the JS file.

<script>
  var var_name = '{{t "Show more results" }}';
</script>

Hi @ahmadajmi and thanks for your comment.

That’s what I was going to do without a proper way to keep the logique in the same file . Do you mean it is not possible to translate within .js ? (as in the title, I forgot to mention I already know how to translate in .hbs)

Well, I don’t know if it is possible or not but the way I shared is what I use and works great for me.