Redigera

Dela via


Localize mobile workspaces

Important

The finance and operations (Dynamics 365) mobile app and platform are no longer supported. The platform components supporting the mobile app will be removed in a future update. The mobile app has also been removed from app stores. Previously installed instances of the app will continue to work. For more information, see Removed or deprecated platform features.

You can use workspace classes in several ways to provide localization support to workspaces.

Use config objects to pass localized labels

A config object can be added to the workspace metadata when it's requested by the mobile app. Later, the config object can be used to provide localization support.

For example, the following workspace requires localized labels for the pageLink control that you added via the business logic.

Customer details workspace where the Rentals link text isn't localized.

The business logic for the app contains a call to the addLink method, as shown in the following illustration. This addLink method adds a link to the Rentals page for the current customer. In this case, the label for the link is Rentals. However, because there isn't a localized label for the link, the link always appears as Rentals.

Call to metadataService.addLink.

To use a config object to provide localized labels, follow these steps.

  1. Create a config class that contains the fields for the labels. One field, rentalLinkLabel, is added to the class that will contain the label for the pageLink control. The config class must be a data contract class.

    Config class code.

  2. The config class is used by a workspace class for the workspace. The workspace class requires the appId value of the workspace. You can find the app ID in the App designer, as shown in the following illustration.

    App ID in the workspace summary.

    The following illustration shows what the workspace class looks like when the appId value is set on the attribute. The class also contains a method, addConfig, that sets a config object that contains the value for the label.

    Workspace class.

    The following illustration shows the config object in the appInit call in the mobile app.

    Config object in the mobile app.

  3. The config object can now be used and passed to the addLink method instead of the hard-coded label.

    metadataService.addLink with a call to the config object.

Use a workspace class to update the workspace title and description

A workspace class can be used to provide localized strings for the workspace title and description. If you don't localize the title and description, the fields will be in the language that you implemented them in. In this example, we will localize a workspace where MyWorkspace is the title and A sample workspace is the description.

List of workspaces.

Selected workspace.

  1. If you don't have a workspace class for your workspace, create a workspace class.

  2. Override the getWorkspaceMetadata method to get the workspace metadata. You must have the workspace metadata to provide labels for the workspace title and description fields.

  3. Use the workspaceTitle and workspaceDescription properties to set the workspace title and description from a label. In the following illustration, placeholders are assigned to the workspaceTitle and workspaceDescription properties.

    Providing a title and a description in the workspace class.

  4. Build the workspace class.

  5. Update the app list on the mobile client.

The following illustration shows the title and description on a phone that uses English and Danish.

Final workspace.