application.appLanguage is undefined

Hi,

I am trying to localize my plugin and can’t get through identifying user XD’s language.
Whenever I import “application” and access its property “appLanguage” it is undefined.

Code:

const { appLanguage } = require("application");

Manifest:

 {
   "name": "My plugin",
   "host": {
     "app": "XD",
     "minVersion": "21.0"
   },
   "helpUrl": "https://forms.gle/AxT7xpd3fdxbYKGJ9",
   "id": "9adb588a",
   "icons": [
     {
       "path": "assets/logo.png",
       "width": 24,
       "height": 24
     }
   ],
   "languages": [
     "en",
     "ja",
     "fr"
   ],
   "uiEntryPoints": [
     {
       "label": {
         "default": "My plugin",
         "ja": "My plugin Ja",
         "fr": "My plugin Fr"
       },
       "type": "panel",
       "panelId": "runAEMForXd"
     }
   ],
   "version": "0.0.1"
 }

XD version: 26

Did I run into some sort of plugin’s limitations here?

That works correctly for me. Are you using Webpack or something similar which might be hiding XD’s "application" module from you? Can you see if the other fields & APIs that are expected to exist on application are showing up as undefined?

1 Like

Thank you for your reply. I use Webpack that’s true, but it does not hide the “application” module as some other properties and functions are available. I am including the entire “application” module below:

{ RenditionType: { PNG: 'png', JPG: 'jpg', SVG: 'svg', PDF: 'pdf' },
  ErrorType: 
   { API_BAD_REQUEST: 'api.bad_request',
     API_UNKNOWN_REQUEST: 'api.unknown_request',
     IO_FAILED: 'io.failed',
     RENDER_TOO_LARGE: 'render.too_large',
     INPUT_NODE_NOT_FOUND: 'input.node_not_found' },
  createRenditions: [Function],
  editDocument: [Function],
  _createRenditions: [Function: _createRenditions],
  _getObjectsToExport: [Function: _getObjectsToExport],
  default: 
   { RenditionType: { PNG: 'png', JPG: 'jpg', SVG: 'svg', PDF: 'pdf' },
     ErrorType: 
      { API_BAD_REQUEST: 'api.bad_request',
        API_UNKNOWN_REQUEST: 'api.unknown_request',
        IO_FAILED: 'io.failed',
        RENDER_TOO_LARGE: 'render.too_large',
        INPUT_NODE_NOT_FOUND: 'input.node_not_found' },
     createRenditions: [Function],
     editDocument: [Function],
     _createRenditions: [Function: _createRenditions],
     _getObjectsToExport: [Function: _getObjectsToExport] } }