Search code examples
autodesk-forgeautodesk-viewerautodeskforge

Forge Viewer_Languages


I would like to know how to change the language of the toolbar in the Forge viewer buttons, depending on the language chosen by the user. For example, being able to switch between Spanish, English, or Italian, etc.

Thanks.


Solution

  • According to the documentation you can change the language when initialising the viewer. If the language is not found it will fall back to the default which is English.

    function launchViewer(urn) {
      var options = {
        env: 'AutodeskProduction',
        getAccessToken: getForgeToken,
        language: <enter your language code here e.g. 'es', 'fr', 'it' ... >
      };
    
      Autodesk.Viewing.Initializer(options, () => {
        viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('forgeViewer'), { extensions: [ 'Autodesk.DocumentBrowser'] });
        viewer.start();
        var documentId = 'urn:' + urn;
        Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
      });
    }