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

Side by Side Diff: docs/usage/README.md

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

Powered by Google App Engine
This is Rietveld