diff --git a/src/content/docs/developer/crowdin-apps/apps-js.mdx b/src/content/docs/developer/crowdin-apps/apps-js.mdx index 0f652900..bbe51589 100644 --- a/src/content/docs/developer/crowdin-apps/apps-js.mdx +++ b/src/content/docs/developer/crowdin-apps/apps-js.mdx @@ -38,6 +38,7 @@ Retrieves a `ContextDataObject` containing key information about the environment **Example:** @@ -70,7 +71,7 @@ AP.getContext(function(contextData) { ##### Response Payload Example -```json collapse={16-25,29-63,66-68} +```json collapse={36-97} { "user_id": 15, "user_login": "john.smith", @@ -78,6 +79,33 @@ AP.getContext(function(contextData) { "project_identifier": "docs-portal", "organization_id": 100001, "organization_domain": "acme", + "user": { + "id": 15, + "username": "john.smith", + "fullname": "John Smith", + "isAdmin": false + }, + "project": { + "id": 123, + "name": "Docs Portal", + "identifier": "docs-portal", + "type": "file-based", + "sourceLanguage": "en", + "targetLanguages": ["fr", "uk"], + "description": "Public documentation portal" + }, + "permissions": [ + { + "name": "translator", + "allLanguages": false, + "languages": ["fr"] + }, + { + "name": "proofreader", + "allLanguages": true, + "languages": [] + } + ], "editor": { "mode": "translate", "theme": "dark", @@ -191,6 +219,134 @@ AP.getContext(function(contextData) {
Description: The domain of the organization the app is installed in (Crowdin Enterprise only).
+userType: object
Description: An object containing details of the user the app is displayed to.
+user.idType: integer
Description: The unique numeric ID of the user.
+user.usernameType: string
Description: The username of the user.
+user.fullnameType: string
Description: The full name of the user.
+user.isAdminType: boolean
Description: Crowdin Enterprise only. Whether the user has organization administrator + access.
+projectType: object
Description: An object containing details of the project the app is running in. Present when + the app runs in a project context.
+project.idType: integer
Description: The unique numeric ID of the project.
+project.nameType: string
Description: The display name of the project.
+project.identifierType: string
Description: The identifier of the project.
+project.typeType: string
Allowed values: file-based, string-based
project.sourceLanguageType: string | null
Description: The language code of the project source language.
+project.targetLanguagesType: array
Description: The language codes of the project target languages.
+project.descriptionType: string
Description: The project description.
+permissionsType: array
Description: The roles the user holds in the current project. Only the highest-level access
+ is listed, so a user with the admin, owner, manager, or
+ developer role has no translator, proofreader, or
+ language_coordinator entry. Present when the app runs in a project context, and empty for a user
+ with no role in the project.
permissions[].nameType: string
Allowed values: admin (Crowdin Enterprise only), owner,
+ manager, developer, language_coordinator, translator,
+ proofreader
permissions[].allLanguagesType: boolean
Description: Whether the role covers every target language of the project.
+permissions[].languagesType: array
Description: The language codes the role is limited to. Empty when
+ allLanguages is true.
editorcallback |
+
+ Type: Required: yes +Description: A callback function that handles the response. It receives one argument: the |
+
The snapshot repeats every field of the AP.getContext response and adds the
+ fields below.
currentString |
+
+ Type: Description: The currently active source string. See |
+
stringsList |
+
+ Type: Description: The strings currently visible in the string list. See |
+
selectedStrings |
+
+ Type: Description: The strings currently selected in the Editor list. See |
+
translations |
+
+ Type: Description: The translations and suggestions for the current string. See |
+
topTranslation |
+
+ Type: Description: The top translation of the current string. See |
+
filter |
+
+ Type: Description: The numeric ID of the active basic filter. See |
+
customFilter |
+
+ Type: Description: The current state of the Advanced Filter. See |
+
croqlFilter |
+
+ Type: Description: The active CroQL filter query, or an empty string when no filter is set. See
+ |
+
filtersList |
+
+ Type: Description: The available basic filters, with their names and numeric IDs. See |
+
page |
+
+ Type: Description: The current page number of the string list. See |
+
workflowStepStatusFilter |
+
+ Type: Description: Crowdin Enterprise only. The active filter for workflow step status at the
+ current workflow step, or |
+
selectedFiles |
+
+ Type: Description: The files selected in the file tree. See |
+
isMultipleFilesSelected |
+
+ Type: Description: Whether more than one file is selected in the file tree. See |
+
unsavedSourceStrings |
+
+ Type: Description: The source strings that have unsaved changes. See |
+
Type: string
Allowed values: ALL, ToDo, Pending, Done
Allowed values: ALL, TODO, PENDING,
+ INCOMPLETE, DONE
PENDING applies to review mode, and INCOMPLETE to
+ translate, proofread, and multilingual modes. The Editor shows both as
+ Pending in the Workflow step status menu.
Type: string
Required: Yes
Description: The status to filter by.
-Allowed values: ALL, TODO, PENDING, DONE
Allowed values: ALL, TODO, PENDING,
+ INCOMPLETE, DONE
PENDING applies to review mode, and INCOMPLETE to
+ translate, proofread, and multilingual modes. The Editor shows both as
+ Pending in the Workflow step status menu.
Payload: An object containing editor context and suggestion data.
pageState.changedFires when any part of the Editor page state changes. Changes that happen within 200 ms are reported as a + single event.
+Payload: The full PageStateObject, plus a changed array naming the
+ fields that triggered the event. See AP.getPageState for the object
+ structure. Treat changed as a hint about what to re-read: the payload always carries the latest
+ state.