Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: docs/usage/xml-sync.md

Issue 29886648: Issue #6942 - Add XTM integration in CMS (Closed)
Left Patch Set: Addressed comments on patch set #2 Created Oct. 3, 2018, 2:50 p.m.
Right Patch Set: Addressed comments from Patch Set #4 Created Oct. 5, 2018, 4:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 # XTM Integration 1 # XTM Integration
2 2
3 The integration with the XTM API can be run using the following command: 3 The integration with the XTM API can be run using the following command:
4 4
5 python -m cms.bin.xtm_translations [-h] [-v] {login,create,upload,download} 5 python -m cms.bin.xtm_translations [-h] [-v] {login,create,upload,download}
6 6
7 7
8 and it has four main operational modes: 8 and it has four main operational modes:
9 9
10 10
11 ### 1. XTM Login 11 ## 1. XTM Login
Vasily Kuznetsov 2018/10/05 10:56:26 In other parts of CMS documentation we use second
Tudor Avram 2018/10/05 12:34:41 Done.
12
12 This mode prompts the user for the login credentials and prompts 13 This mode prompts the user for the login credentials and prompts
13 the API for the authentication token. This token should then be saved as an 14 the API for the authentication token. This token should then be saved as an
14 environment variable to be used in the other modes. It can be run as follows: 15 environment variable to be used in the other modes. It can be run as follows:
15 16
16 17
17 python -m cms.bin.xtm_translations [-h] [-v] login [-h] 18 python -m cms.bin.xtm_translations [-h] [-v] login [-h]
18 19
19 20
20 21
21 ### 2. Project Creation 22 ## 2. Project Creation
23
22 In this mode, one can create an XTM project. It can be run as follows: 24 In this mode, one can create an XTM project. It can be run as follows:
23 25
24 26
25 python -m cms.bin.xtm_translations [-h] [-v] create [-h] --name NAME 27 python -m cms.bin.xtm_translations [-h] [-v] create [-h] --name NAME
26 --desc DESC --client-id CLIENT_ID --ref-id REF_ID 28 --desc DESC --client-id CLIENT_ID --ref-id REF_ID
27 --workflow-id WORKFLOW_ID [--source-lang SOURCE_LANG] 29 --workflow-id WORKFLOW_ID [--source-lang SOURCE_LANG]
28 [--save-id] [source_dir] 30 [--save-id] [source_dir]
29 31
30 32
31 where: 33 where:
32 * --name* = The name of the project will have once created. 34 * --name* = The name of the project will have once created.
33 * *--desc** = The description you wish to add to the project. 35 * *--desc** = The description you wish to add to the project.
34 * *--client-id** = The id of the **pre-configured** XTM client you want 36 * *--client-id** = The id of the **pre-configured** XTM client you want
35 associated with the project. Has to be an integer! 37 associated with the project. Has to be an integer!
36 * *--ref-id** = The reference id you want associated with the XTM project. 38 * *--ref-id** = The reference id you want associated with the XTM project.
37 * *--workflow-id** = The id of the **pre-configured** XTM workflow to be 39 * *--workflow-id** = The id of the **pre-configured** XTM workflow to be
38 associated with the project. Has to be an integer! 40 associated with the project. Has to be an integer!
39 * *--source-lang* = The language of the source files. If not provided, 41 * *--source-lang* = The language of the source files. If not provided,
wspee 2018/10/10 15:09:16 This parameter is not mandatory
40 the script will use `en_US` by default. 42 the script will use `en_US` by default.
41 * *--save-id* = Whether to save the id of the newly created project into 43 * *--save-id* = Whether to save the id of the newly created project into
wspee 2018/10/10 15:09:16 This parameter is not mandatory
42 'settings.ini' or not. 44 'settings.ini' or not.
43 * *source_dir* = The source directory of the website. If not specified, the 45 * *source_dir* = The source directory of the website. If not specified, the
44 script would consider the current working directory as the source for the websit e. 46 script would consider the current working directory as the source for the websit e.
45 It will be used to extract all the translation strings and create the files 47 It will be used to extract all the translation strings and create the files
46 to be uploaded on project creation. It will also be used to automatically 48 to be uploaded on project creation. It will also be used to automatically
47 detect the target languages for this specific project. 49 detect the target languages for this specific project.
48 50
49 **Note:** All arguments marked with * are **mandatory** and the script will 51 **Note:** All arguments marked with * are **mandatory** and the script will
50 fail if not provided. 52 fail if not provided.
51 53
52 In order for this mode to work, it requires the XTM authentication token 54 In order for this mode to work, it requires the XTM authentication token
53 to be saved in the `XTM_TOKEN` environment variable. 55 to be saved in the `XTM_TOKEN` environment variable.
54 56
55 57
56 ### 3. File Uploading 58 ## 3. File Uploading
59
57 This mode can be used to upload new files for translation to an existing project . 60 This mode can be used to upload new files for translation to an existing project .
58 It can be run as follows: 61 It can be run as follows:
59 62
60 63
61 python -m cms.bin.xtm_translations [-h] [-v] upload [-h] [--no-overwrite] 64 python -m cms.bin.xtm_translations [-h] [-v] upload [-h] [--no-overwrite]
wspee 2018/10/10 15:09:15 Also it might make sense to document the settings.
wspee 2018/10/10 15:09:15 For a per issue workflow (and also in general) it
62 [source_dir] 65 [source_dir]
63 66
64 67
65 where: 68 where:
66 * *--no-overwrite* = If this flag is set, then the script would **create new 69 * *--no-overwrite* = If this flag is set, then the script would **create new
67 files** in XTM, instead of overwriting the ones that were already there. 70 files** in XTM, instead of overwriting the ones that were already there.
68 * *source_dir* = The source directory of the website. See above for the full 71 * *source_dir* = The source directory of the website. See above for the full
69 explanation. 72 explanation.
70 73
71 If you wish to add a new target language to the project automatically, 74 If you wish to add a new target language to the project automatically,
72 simply create a corresponding directory in the website's `locales` directory 75 simply create a corresponding directory in the website's `locales` directory
73 and the script will update the XTM project accordingly before uploading the 76 and the script will update the XTM project accordingly before uploading the
74 new files and will create jobs for the new languages as well. 77 new files and will create jobs for the new languages as well.
75 78
76 In order for this mode to work, it requires two things to be present: 79 In order for this mode to work, it requires two things to be present:
77 1. The XTM authentication token saved in the `XTM_TOKEN` environment variable. 80 1. The XTM authentication token saved in the `XTM_TOKEN` environment variable.
78 2. The XTM project number present in `settings.ini`, under the `project_id` 81 2. The XTM project number present in `settings.ini`, under the `project_id`
79 option, in the `XTM` section. 82 option, in the `XTM` section.
80 83
81 84
82 ### 4. Translation Files Downloading 85 ## 4. Translation Files Downloading
86
83 This mode downloads the translation files from the XTM project and saves them 87 This mode downloads the translation files from the XTM project and saves them
84 in the website's `locales` directory. It can be run as follows: 88 in the website's `locales` directory. It can be run as follows:
85 89
86 python -m cms.bin.xtm_translations [-h] [-v] download [-h] [source_dir] 90 python -m cms.bin.xtm_translations [-h] [-v] download [-h] [source_dir]
87 91
88 92
89 where `source_dir` is the source directory of the website. See above for full 93 where `source_dir` is the source directory of the website. See above for full
90 explanation. 94 explanation.
91 95
92 When run in this mode, the script will remove all the translation files that 96 When run in this mode, the script will remove all the translation files that
93 were previously saved locally and then save the new ones in their place. 97 were previously saved locally and then save the new ones in their place.
94 98
95 In order for this mode to work, three requirements need to be fulfilled: 99 In order for this mode to work, three requirements need to be fulfilled:
96 1. The XTM authentication token saved in the `XTM_TOKEN` environment variable. 100 1. The XTM authentication token saved in the `XTM_TOKEN` environment variable.
97 2. The XTM project number present in `settings.ini`, under the `project_id` 101 2. The XTM project number present in `settings.ini`, under the `project_id`
98 option, in the `XTM` section. 102 option, in the `XTM` section.
99 3. (At least one) translation file(s) to be present in XTM. 103 3. (At least one) translation file(s) to be present in XTM.
104
105
106 ## Dependencies
107
108 On top of the Python standard library, this script requires the following
109 additional libraries to run correctly:
110
111 1. [Markdown](https://pypi.org/project/Markdown/)
112 2. [Jinja2](https://pypi.org/project/Jinja2/)
113 3. [Requests](https://pypi.org/project/requests/)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld