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

Side by Side Diff: docs/usage/xml-sync.md

Issue 29977630: Noissue - Add [paths] documentation and remove trailing spaces (Closed) Base URL: https://hg.adblockplus.org/cms/
Patch Set: Created Jan. 10, 2019, 1:26 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« docs/content/settings.md ('K') | « docs/content/static.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
12 12
13 This mode prompts the user for the login credentials and prompts 13 This mode prompts the user for the login credentials and prompts
14 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
15 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:
16 16
17 17
18 python -m cms.bin.xtm_translations [-h] [-v] login [-h] 18 python -m cms.bin.xtm_translations [-h] [-v] login [-h]
19 19
20 20
21 21
22 ## 2. Project Creation 22 ## 2. Project Creation
23 23
24 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:
25 25
26 26
27 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
28 --desc DESC --client-id CLIENT_ID --ref-id REF_ID 28 --desc DESC --client-id CLIENT_ID --ref-id REF_ID
29 --workflow-id WORKFLOW_ID [--source-lang SOURCE_LANG] 29 --workflow-id WORKFLOW_ID [--source-lang SOURCE_LANG]
30 [--save-id] [source_dir] 30 [--save-id] [source_dir]
31 31
32 32
33 where: 33 where:
34 * --name* = The name of the project will have once created. 34 * --name* = The name of the project will have once created.
35 * *--desc** = The description you wish to add to the project. 35 * *--desc** = The description you wish to add to the project.
36 * *--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
37 associated with the project. Has to be an integer! 37 associated with the project. Has to be an integer!
38 * *--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.
39 * *--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
40 associated with the project. Has to be an integer! 40 associated with the project. Has to be an integer!
41 * *--source-lang* = The language of the source files. If not provided, 41 * *--source-lang* = The language of the source files. If not provided,
42 the script will use `en_US` by default. 42 the script will use `en_US` by default.
43 * *--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
44 'settings.ini' or not. 44 'settings.ini' or not.
45 * *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
46 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.
47 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
48 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
49 detect the target languages for this specific project. 49 detect the target languages for this specific project.
50 50
51 **Note:** All arguments marked with * are **mandatory** and the script will 51 **Note:** All arguments marked with * are **mandatory** and the script will
52 fail if not provided. 52 fail if not provided.
53 53
54 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
55 to be saved in the `XTM_TOKEN` environment variable. 55 to be saved in the `XTM_TOKEN` environment variable.
56 56
57 57
58 ## 3. File Uploading 58 ## 3. File Uploading
59 59
60 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 .
61 It can be run as follows: 61 It can be run as follows:
62 62
63 63
64 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]
65 [source_dir] 65 [source_dir]
66 66
67 67
68 where: 68 where:
69 * *--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
70 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.
71 * *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
72 explanation. 72 explanation.
73 73
74 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,
75 simply create a corresponding directory in the website's `locales` directory 75 simply create a corresponding directory in the website's `locales` directory
76 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
77 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.
78 78
79 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:
80 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.
81 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`
82 option, in the `XTM` section. 82 option, in the `XTM` section.
83 83
84 84
85 ## 4. Translation Files Downloading 85 ## 4. Translation Files Downloading
86 86
87 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
88 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:
89 89
90 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]
91 91
92 92
93 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
94 explanation. 94 explanation.
95 95
96 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
97 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.
98 98
99 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:
100 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.
101 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`
102 option, in the `XTM` section. 102 option, in the `XTM` section.
103 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 104
105 105
106 ## Dependencies 106 ## Dependencies
107 107
108 On top of the Python standard library, this script requires the following 108 On top of the Python standard library, this script requires the following
109 additional libraries to run correctly: 109 additional libraries to run correctly:
110 110
111 1. [Markdown](https://pypi.org/project/Markdown/) 111 1. [Markdown](https://pypi.org/project/Markdown/)
112 2. [Jinja2](https://pypi.org/project/Jinja2/) 112 2. [Jinja2](https://pypi.org/project/Jinja2/)
113 3. [Requests](https://pypi.org/project/requests/) 113 3. [Requests](https://pypi.org/project/requests/)
114 114
115 Prev: [Syncing translations](syncing-translations.md) | Up: [Home](../../README. md) | Next: [Configuration (`settings.ini`)](../content/settings.md) 115 Prev: [Syncing translations](syncing-translations.md) | Up: [Home](../../README. md) | Next: [Configuration (`settings.ini`)](../content/settings.md)
OLDNEW
« docs/content/settings.md ('K') | « docs/content/static.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld