Zum Inhalt springen

Context Menu Module

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

In Crowdin uebersetzen

This module allows creating custom items in Crowdin’s context menus.

Crowdin context menus:

  • Resources > TM > TM record
  • Resources > Glossary > Glossary record
  • Project home tab > Language record
  • Project > Content > Files > File record
  • Project > Content > Screenshots > Screenshot record
  • Project > Language page > File record

Crowdin Enterprise context menus:

  • Workspace > TM > TM record
  • Workspace > Glossary > Glossary record
  • Project home page > Language record
  • Project > Content > Files > File record
  • Project > Content > Screenshots > Screenshot record
  • Project home page > Language page > File record

A context menu item can open a specified app module with additional context related to the selected record or custom URL. There are the following types of actions:

  • Open a specified app module in a modal dialog (see Modal module)
  • Redirect to a specified app module
  • Open a custom URL in a new tab

You can grant access to this module to one of the following user categories:

For Crowdin:

  • Only me (i.e., project owner)
  • Me, project managers and developers (if location: language, screenshot, source_file, translated_file)
  • All project members
  • Selected users

For Crowdin Enterprise:

  • Only organization admins
  • Organization admins, project managers and developers (if location: language, screenshot, source_file, translated_file)
  • All users in the organization projects
  • Selected users

Context menu item shows the specified module in the modal.

manifest.json
{
"modules": {
"context-menu": [
{
"key": "context-menu-key",
"name": "Name of Context Menu Item",
"description": "Description of Context Menu Item",
"options": {
"location": "source_file",
"type": "modal",
"module": {
"modal": "modal-module-key"
},
"signaturePatterns": {
"fileName": ".*\\.json",
"nodeType": [0, 1]
}
}
}
],
"modal": [
{
"key": "modal-module-key",
"name": "New Modal",
"url": "/path/to/integration/module"
}
]
}
}

Context menu item redirects to the specified module.

manifest.json
{
"modules": {
"context-menu": [
{
"key": "context-menu-key",
"name": "Name of Context Menu Item",
"description": "Description of Context Menu Item",
"options": {
"location": "source_file",
"type": "redirect",
"module": {
"project-integrations": "integration-module-key"
},
"signaturePatterns": {
"fileName": ".*\\.json",
"nodeType": [0, 1]
}
}
}
],
"project-integrations": [
{
"key": "integration-module-key",
"name": "New Integration",
"logo": "/integration-logo.png",
"url": "/path/to/integration/module"
}
]
}
}

Context menu item opens a new tab with the URL: baseUrl/options.url.

manifest.json
{
"baseUrl": "https://app.example.com",
"modules": {
"context-menu": [
{
"key": "context-menu-key",
"name": "Name of Context Menu Item",
"description": "Description of Context Menu Item",
"options": {
"location": "source_file",
"type": "new_tab",
"url": "/example/path",
"signaturePatterns": {
"fileName": ".*\\.json",
"nodeType": [0, 1]
}
}
}
]
}
}
key

Type: string

Required: yes

Description: Module identifier within the Crowdin app.

name

Type: string

Required: yes

Description: The human-readable name displayed in the context menu.

description

Type: string

Description: A human-readable description of what the module does.
The description will be visible in the Crowdin UI.

options.location

Type: string

Required: yes

Allowed values: tm, glossary, style_guide, language, screenshot, source_file, translated_file

Description: The location in UI where the context menu can be added.

options.type

Type: string

Required: yes

Allowed values: modal, new_tab, redirect

Description: The type of action this module will perform.

options.url

Type: string

Description: Relative URL.

Use it only with new_tab type

options.module

Type: object

Description: Module definition.

Use it only with modal and redirect types

signaturePatterns

Type: object

Description: Contains criteria used to detect the type of file or node, specifying when the context menu item is shown.

Use it only when options.location is set to source_file

signaturePatterns.fileName

Type: string

Description: Contains fileName regular expressions used to detect file type.

signaturePatterns.nodeType

Type: array

Allowed values: 0 – folder, 1 – file, 2 – branch

Description: Array of node types specifying when the context menu item appears.

environments

Type: string

Allowed values: crowdin, crowdin-enterprise

Description: Set of environments where a module could be installed.
This parameter is needed for cross-product applications.

War diese Seite hilfreich?