Application Packaging Standard

Last updated 18-Mar-2019

Internationalization (optional)

In a case you need to enable your view-plugin messages to be translated to various languages, you can require the platform UI to use translations in the package where the view-plugin source is shipped. Otherwise, it will try to find translations in the system package implementing the home dashboard application.

Continue your demo project from the previous step.

Update the view-plugin source code as follows.

  1. In the define list, add more modules that allow you to find the source package and bind the current module to a specified package.

    define([
       "module",
       "aps/i18n",
       "aps/common",
       ...
    ], function (
       module,
       i18n,
       common,
       ...
    ) {
    // ...
    });
    
  2. Redefine the translation function _() to bind it to the APS application package:

    var _ = i18n.bindToPackage(common.getPackageId(module));
    

    The commonJS module carries the fully-qualified URI from which the current view-plugin was loaded.

  3. Wrap each translation string into the translation function, for example:

    addResourceLabel: _("Get your own virtual servers"), // Button label
    

Finally, the updated vpsDashboardPlugin.js file looks as follows:

define([
    "dojo/_base/declare",
    "module",
    "aps/i18n",
    "aps/common",
    "aps/nav/ViewPlugin"
], function(
    declare,
    module,
    i18n,
    common,
    ViewPlugin
) {
    var _ = i18n.bindToPackage(common.getPackageId(module));

    return declare(ViewPlugin, {

        /* Displayed resources */
        apsType: "http://aps-standard.org/samples/basic1pdash/vps",

        /* Button label */
        addResourceLabel: _("Get your own virtual servers"),

        /* Message displayed when there are no resources to show */
        noResourcesText: _("No virtual servers discovered"),

        /* Notification about the new service */
        promoPrimaryText: _("The Service You Know"),

        /* On button click - go to 'Add Resource' view */
        addResourceViewId: "server-new-1",

        /* On tile click - go to the servers list */
        entryViewId: "servers"
    });
});

Update the APS application as explained in the Update APS Application section and test the view-plugin in the Home dashboard as explained in the Test Generic Operations section.