How to make this code in Visual Studio?

Install it from NPM and go through the documentation, hope that it will help you
https://www.npmjs.com/package/jquery-lang-js

<script src="https://stackoverflow.com/questions/51251793/js/jquery-lang.js" charset="utf-8" type="text/javascript"></script>

Add the following to your HTML page in either the head or body:

<script type="text/javascript">
    // Create language switcher instance
    var lang = new Lang();

    lang.init({
        defaultLang: 'en'
    });
</script>

The init() method takes an options object with the following structure:

lang.init({
    /**
     * The default language of the page / app.
     * @type String
     * @required 
     */
    defaultLang: 'en',

    /**
     * The current language to set the page to.
     * @type String
     * @optional 
     */
    currentLang: 'en',

    /**
     * This object is only required if you want to override the default
     * settings for cookies.
     */
    cookie: {
        /**
         * Overrides the default cookie name to something else. The default
         * is "langCookie".
         * @type String
         * @optional
         */
        name: 'langCookie',

        expiry: 365,
        path: "https://stackoverflow.com/"
    },

    /**
     * If true, cookies will override the "currentLang" option if the
     * cookie is set. You usually shouldn't need to specify this option
     * at all unless your JavaScript lang.init() method is being
     * dynamically generated by PHP or other server-side processor.
     * @type Boolean
     * @optional 
     */
    allowCookieOverride: true
}); 

Leave a Comment