Using the custom-translation commands

You can use the custom-translation commands to create an import or export task that will import or export a .tgz of custom translations for a Developer Portal site. You can also delete the export and import tasks, get the status of an export or import task, and get a custom translation export artifact.

  1. Log in as Provider org:
    apic login --server management_server --realm provider/identity_provider --username provider_username --password provider_password
    You can determine which identity provider to use in the --realm parameter by entering the following command to see a list of all available identity providers (you do not need to be logged in to use this command):
    apic identity-providers:list --scope provider --server platform_api_host_name --fields title,realm
    For example,
    apic identity-providers:list --scope provider --server platform_api_host_name --fields title,realm 
    total_results: 2
    results:
      - title: API Manager User Registry
        realm: provider/default-idp-2
      - title: Corporate LDAP user registry
        realm: provider/corporate-ldap
    The title value should enable you to determine which identity provider to use; you can then copy the corresponding --realm parameter directly from the displayed realm value. For any identity providers that were created by your administrator after API Connect was installed, the names will have been determined at creation time. The default API Manager Local User Registry for login as a member of a provider organization is default-idp-2.

    For full details of the apic login command, see Logging in to a management server.

  2. Export your custom translations.
    The custom-translation:create-export command creates an export task against the portal of the specified catalog and org, to export an archive of the custom translations of the site. The command then polls the status of the task until it has FINISHED and the artifacts are streamed back. The task ID is printed to the terminal.
    Note:
    • The command continues to poll until the maximum polling time of 15 minutes is reached. At which point you can use the commands custom-translation:get-export-status and custom-translation:get-export to get the status and potentially an artifact.
    • The translation .tgz archive is saved to the directory in which you ran the command.
    • The saved .tgz has the format custom_translation_createExport-20210217134637.tgz.
    • You can save your exports into your change control management system.
    apic --mode portaladmin custom-translation:create-export --catalog catalogid/name --org orgid/name --server management_server
    • catalogid/name is the ID or name of the catalog that the site belongs to (required).
    • orgid/name is the ID or name of the provider organization that the catalog belongs to (required).
    • management_server is the endpoint URL of the management server (required).
    • --langcodes is a comma separated list of the language codes, for example es,zh-hans. You can use this option to specify which custom translations to export.
    • --no-poll can be used to stop the command from polling the task, and just return the task ID.
    For example:
    apic --mode portaladmin custom-translation:create-export --catalog dev --org ibm --server api.stagingexample.com
  3. Import your custom translations.
    The custom-translation:create-import command uses the supplied .tgz file to create a task to import the custom translations into the portal of the specified catalog and org. The command then polls the status of the task until the task has either FINISHED successfully, or failed because of an error. The task ID is printed to the terminal.
    Note:
    • The .tgz archive must contain only .po translation files, and nothing else.
    • The command continues to poll until the maximum polling time of 15 minutes is reached. At which point you can use the command custom-translation:get-import-status to get the status of the import.
    • If you import a custom translation that already exists, the existing custom translation is overwritten.
    apic --mode portaladmin custom-translation:create-import --catalog catalogid/name --org orgid/name --server management_server /PATH/TO/MODULE/TGZ
    • --no-poll can be used to stop the command from polling the task, and just return the task ID.
    For example:
    apic --mode portaladmin custom-translation:create-import --catalog prod --org ibm --server api.productionexample.com C:/users/example/desktop/custom_translation_createExport-20210217134637.tgz
  4. You can run the delete command to cancel any ongoing or recently created import or export tasks. Any temporarily created artifacts will be deleted from the portal filesystem. No custom translations are deleted.
    For example,
    apic --mode portaladmin custom-translation:delete-export --catalog catalogid/name --org orgid/name --server management_server --format json --task_id taskid
    apic --mode portaladmin custom-translation:delete-import --catalog catalogid/name --org orgid/name --server management_server --format json --task_id taskid
    • taskid is the ID of the import or export task that was created on the queue (required).
    • --format is the output format that can be seen if you run the command with debug. Can be json, yaml, go-template=..., go-template-file=.... Defaults to yaml.
    For example:
    apic --mode portaladmin custom-translation:delete-import --catalog prod --org ibm --server api.productionexample.com  --task_id 4hythbptta6z9lyx